Remove hir::Expr::attrs.
This commit is contained in:
parent
dc9560cfd2
commit
6c668266c0
@ -177,7 +177,8 @@ fn check_final_expr<'tcx>(
|
|||||||
// simple return is always "bad"
|
// simple return is always "bad"
|
||||||
ExprKind::Ret(ref inner) => {
|
ExprKind::Ret(ref inner) => {
|
||||||
// allow `#[cfg(a)] return a; #[cfg(b)] return b;`
|
// 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));
|
let borrows = inner.map_or(false, |inner| last_statement_borrows(cx, inner));
|
||||||
if !borrows {
|
if !borrows {
|
||||||
emit_return_lint(
|
emit_return_lint(
|
||||||
|
@ -89,7 +89,7 @@ fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::ImplItem<
|
|||||||
//
|
//
|
||||||
|
|
||||||
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
print_expr(cx, expr, 0);
|
print_expr(cx, expr, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user