Skip to content

Commit a8825e9

Browse files
committed
Use existing 'is_automatically_derived' helper
1 parent a6b72d3 commit a8825e9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

clippy_lints/src/needless_borrow.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
//!
33
//! This lint is **warn** by default
44
5-
use crate::utils::{snippet_opt, span_lint_and_then};
5+
use crate::utils::{is_automatically_derived, snippet_opt, span_lint_and_then};
66
use if_chain::if_chain;
77
use rustc_errors::Applicability;
88
use rustc_hir::{BindingAnnotation, BorrowKind, Expr, ExprKind, HirId, Item, Mutability, Pat, PatKind};
99
use rustc_lint::{LateContext, LateLintPass};
1010
use rustc_middle::ty;
1111
use rustc_middle::ty::adjustment::{Adjust, Adjustment};
1212
use rustc_session::{declare_tool_lint, impl_lint_pass};
13-
use rustc_span::sym;
1413

1514
declare_clippy_lint! {
1615
/// **What it does:** Checks for address of operations (`&`) that are going to
@@ -116,7 +115,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessBorrow {
116115
}
117116

118117
fn check_item(&mut self, _: &LateContext<'tcx>, item: &'tcx Item<'_>) {
119-
if item.attrs.iter().any(|a| a.has_name(sym::automatically_derived)) {
118+
if is_automatically_derived(item.attrs) {
120119
debug_assert!(self.derived_item.is_none());
121120
self.derived_item = Some(item.hir_id);
122121
}

0 commit comments

Comments
 (0)