about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hansch <dev@phansch.net>2021-01-05 16:31:08 +0100
committerPhilipp Hansch <dev@phansch.net>2021-01-05 16:31:08 +0100
commita8825e9af067e10406e13ff7fbe9bbd5c7699a41 (patch)
treef309692327bed4afc46e68f5d381defb91e6da7d
parenta6b72d378f71ed8d2c6849d97571a4c1d8e27afa (diff)
downloadrust-a8825e9af067e10406e13ff7fbe9bbd5c7699a41.tar.gz
rust-a8825e9af067e10406e13ff7fbe9bbd5c7699a41.zip
Use existing 'is_automatically_derived' helper
-rw-r--r--clippy_lints/src/needless_borrow.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/clippy_lints/src/needless_borrow.rs b/clippy_lints/src/needless_borrow.rs
index bff53eb8cca..f1c06692e30 100644
--- a/clippy_lints/src/needless_borrow.rs
+++ b/clippy_lints/src/needless_borrow.rs
@@ -2,7 +2,7 @@
 //!
 //! This lint is **warn** by default
 
-use crate::utils::{snippet_opt, span_lint_and_then};
+use crate::utils::{is_automatically_derived, snippet_opt, span_lint_and_then};
 use if_chain::if_chain;
 use rustc_errors::Applicability;
 use rustc_hir::{BindingAnnotation, BorrowKind, Expr, ExprKind, HirId, Item, Mutability, Pat, PatKind};
@@ -10,7 +10,6 @@ use rustc_lint::{LateContext, LateLintPass};
 use rustc_middle::ty;
 use rustc_middle::ty::adjustment::{Adjust, Adjustment};
 use rustc_session::{declare_tool_lint, impl_lint_pass};
-use rustc_span::sym;
 
 declare_clippy_lint! {
     /// **What it does:** Checks for address of operations (`&`) that are going to
@@ -116,7 +115,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessBorrow {
     }
 
     fn check_item(&mut self, _: &LateContext<'tcx>, item: &'tcx Item<'_>) {
-        if item.attrs.iter().any(|a| a.has_name(sym::automatically_derived)) {
+        if is_automatically_derived(item.attrs) {
             debug_assert!(self.derived_item.is_none());
             self.derived_item = Some(item.hir_id);
         }