]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/trivially_copy_pass_by_ref.rs
MutImmutable -> Immutable, MutMutable -> Mutable, CaptureClause -> CaptureBy
[rust.git] / clippy_lints / src / trivially_copy_pass_by_ref.rs
index 3bda90a66e3af8b00e5e2f542fe6d71bbcbc87e1..616568f36eebe1fc0f28a62a17025d60b99b6026 100644 (file)
@@ -54,6 +54,7 @@
     "functions taking small copyable arguments by reference"
 }
 
+#[derive(Copy, Clone)]
 pub struct TriviallyCopyPassByRef {
     limit: u64,
 }
@@ -96,12 +97,12 @@ fn check_poly_fn(&mut self, cx: &LateContext<'_, 'tcx>, hir_id: HirId, decl: &Fn
             }
 
             if_chain! {
-                if let ty::Ref(input_lt, ty, Mutability::MutImmutable) = ty.kind;
+                if let ty::Ref(input_lt, ty, Mutability::Immutable) = ty.kind;
                 if !output_lts.contains(&input_lt);
                 if is_copy(cx, ty);
                 if let Some(size) = cx.layout_of(ty).ok().map(|l| l.size.bytes());
                 if size <= self.limit;
-                if let hir::TyKind::Rptr(_, MutTy { ty: ref decl_ty, .. }) = input.node;
+                if let hir::TyKind::Rptr(_, MutTy { ty: ref decl_ty, .. }) = input.kind;
                 then {
                     let value_type = if is_self_ty(decl_ty) {
                         "self".into()
@@ -131,7 +132,7 @@ fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Trai
             return;
         }
 
-        if let hir::TraitItemKind::Method(method_sig, _) = &item.node {
+        if let hir::TraitItemKind::Method(method_sig, _) = &item.kind {
             self.check_poly_fn(cx, item.hir_id, &*method_sig.decl, None);
         }
     }
@@ -166,7 +167,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.node, ItemKind::Impl(_, _, _, _, Some(_), _, _) |
+            if matches!(item.kind, ItemKind::Impl(_, _, _, _, Some(_), _, _) |
                 ItemKind::Trait(..))
             {
                 return;