diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2020-11-27 17:41:05 +0100 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-03-09 19:27:58 +0100 |
| commit | 6c668266c0d4a949e534bb2770fa3fcc8b64ef1d (patch) | |
| tree | 53713c9bd7cac1f0dd71ce04b0e09bad543f1ff7 | |
| parent | dc9560cfd2e466ffbaf4615197ed4386ccb90c1d (diff) | |
| download | rust-6c668266c0d4a949e534bb2770fa3fcc8b64ef1d.tar.gz rust-6c668266c0d4a949e534bb2770fa3fcc8b64ef1d.zip | |
Remove hir::Expr::attrs.
| -rw-r--r-- | clippy_lints/src/returns.rs | 3 | ||||
| -rw-r--r-- | clippy_lints/src/utils/inspector.rs | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/clippy_lints/src/returns.rs b/clippy_lints/src/returns.rs index e8646695e0b..40c0f1f4589 100644 --- a/clippy_lints/src/returns.rs +++ b/clippy_lints/src/returns.rs @@ -177,7 +177,8 @@ fn check_final_expr<'tcx>( // simple return is always "bad" ExprKind::Ret(ref inner) => { // allow `#[cfg(a)] return a; #[cfg(b)] return b;` - if !expr.attrs.iter().any(attr_is_cfg) { + let attrs = cx.tcx.hir().attrs(expr.hir_id); + if !attrs.iter().any(attr_is_cfg) { let borrows = inner.map_or(false, |inner| last_statement_borrows(cx, inner)); if !borrows { emit_return_lint( diff --git a/clippy_lints/src/utils/inspector.rs b/clippy_lints/src/utils/inspector.rs index 07a79592a4a..9e3973e1d51 100644 --- a/clippy_lints/src/utils/inspector.rs +++ b/clippy_lints/src/utils/inspector.rs @@ -89,7 +89,7 @@ impl<'tcx> LateLintPass<'tcx> for DeepCodeInspector { // fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) { - if !has_attr(cx.sess(), &expr.attrs) { + if !has_attr(cx.sess(), cx.tcx.hir().attrs(expr.hir_id)) { return; } print_expr(cx, expr, 0); |
