File tree 2 files changed +3
-2
lines changed
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>(
177
177
// simple return is always "bad"
178
178
ExprKind :: Ret ( ref inner) => {
179
179
// 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) {
181
182
let borrows = inner. map_or ( false , |inner| last_statement_borrows ( cx, inner) ) ;
182
183
if !borrows {
183
184
emit_return_lint (
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ impl<'tcx> LateLintPass<'tcx> for DeepCodeInspector {
89
89
//
90
90
91
91
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 ) ) {
93
93
return ;
94
94
}
95
95
print_expr ( cx, expr, 0 ) ;
You can’t perform that action at this time.
0 commit comments