Skip to content

Commit

Permalink
Remove hir::Expr::attrs.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Mar 9, 2021
1 parent dc9560c commit 6c66826
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion clippy_lints/src/returns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6c66826

Please sign in to comment.