mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-18 03:25:55 +00:00
Use existing 'is_automatically_derived' helper
This commit is contained in:
parent
a6b72d378f
commit
a8825e9af0
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user