X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=clippy_lints%2Fsrc%2Ftrivially_copy_pass_by_ref.rs;h=0f00ed6c1fadd94229e05d3452d1890e3ec1e23c;hb=2ff568d746e4641b992c0b74bea046e43a637997;hp=ac31757d17d5b6d5660f1c191a24023cb02c005c;hpb=05cb0df748dbc14c43dea4d627d68721a52861c6;p=rust.git diff --git a/clippy_lints/src/trivially_copy_pass_by_ref.rs b/clippy_lints/src/trivially_copy_pass_by_ref.rs index ac31757d17d..0f00ed6c1fa 100644 --- a/clippy_lints/src/trivially_copy_pass_by_ref.rs +++ b/clippy_lints/src/trivially_copy_pass_by_ref.rs @@ -2,14 +2,13 @@ use crate::utils::{is_copy, is_self_ty, snippet, span_lint_and_sugg}; use if_chain::if_chain; -use matches::matches; -use rustc::session::config::Config as SessionConfig; use rustc::ty; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::intravisit::FnKind; -use rustc_hir::*; +use rustc_hir::{Body, FnDecl, HirId, ItemKind, MutTy, Mutability, Node}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_session::config::Config as SessionConfig; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::Span; use rustc_target::abi::LayoutOf; @@ -132,7 +131,7 @@ fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Trai return; } - if let hir::TraitItemKind::Method(method_sig, _) = &item.kind { + if let hir::TraitItemKind::Fn(method_sig, _) = &item.kind { self.check_poly_fn(cx, item.hir_id, &*method_sig.decl, None); } } @@ -167,7 +166,7 @@ fn check_fn( // Exclude non-inherent impls if let Some(Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(hir_id)) { - if matches!(item.kind, ItemKind::Impl(_, _, _, _, Some(_), _, _) | + if matches!(item.kind, ItemKind::Impl{ of_trait: Some(_), .. } | ItemKind::Trait(..)) { return;