File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff 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 (
Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments