Skip to content

Commit 6c66826

Browse files
committed
Remove hir::Expr::attrs.
1 parent dc9560c commit 6c66826

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clippy_lints/src/returns.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ fn check_final_expr<'tcx>(
177177
// simple return is always "bad"
178178
ExprKind::Ret(ref inner) => {
179179
// allow `#[cfg(a)] return a; #[cfg(b)] return b;`
180-
if !expr.attrs.iter().any(attr_is_cfg) {
180+
let attrs = cx.tcx.hir().attrs(expr.hir_id);
181+
if !attrs.iter().any(attr_is_cfg) {
181182
let borrows = inner.map_or(false, |inner| last_statement_borrows(cx, inner));
182183
if !borrows {
183184
emit_return_lint(

clippy_lints/src/utils/inspector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl<'tcx> LateLintPass<'tcx> for DeepCodeInspector {
8989
//
9090

9191
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
92-
if !has_attr(cx.sess(), &expr.attrs) {
92+
if !has_attr(cx.sess(), cx.tcx.hir().attrs(expr.hir_id)) {
9393
return;
9494
}
9595
print_expr(cx, expr, 0);

0 commit comments

Comments
 (0)