Skip to content

Commit

Permalink
Use existing 'is_automatically_derived' helper
Browse files Browse the repository at this point in the history
  • Loading branch information
phansch committed Jan 5, 2021
1 parent a6b72d3 commit a8825e9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions clippy_lints/src/needless_borrow.rs
Expand Up @@ -2,15 +2,14 @@
//!
//! 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};
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
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit a8825e9

Please sign in to comment.