]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/ptr_arg.rs
Merge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2
[rust.git] / tests / ui / ptr_arg.rs
index 30f39e9b06398519302fc7a870da680f0fe5806b..541225e635102b73626c4c7e960c7796f2161f8f 100644 (file)
@@ -71,7 +71,6 @@ fn false_positive_capacity_too(x: &String) -> String {
 #[allow(dead_code)]
 fn test_cow_with_ref(c: &Cow<[i32]>) {}
 
-#[allow(dead_code)]
 fn test_cow(c: Cow<[i32]>) {
     let _c = c;
 }
@@ -84,3 +83,34 @@ trait Foo2 {
 impl Foo2 for String {
     fn do_string(&self) {}
 }
+
+// Check that the allow attribute on parameters is honored
+mod issue_5644 {
+    use std::borrow::Cow;
+
+    fn allowed(
+        #[allow(clippy::ptr_arg)] _v: &Vec<u32>,
+        #[allow(clippy::ptr_arg)] _s: &String,
+        #[allow(clippy::ptr_arg)] _c: &Cow<[i32]>,
+    ) {
+    }
+
+    struct S {}
+    impl S {
+        fn allowed(
+            #[allow(clippy::ptr_arg)] _v: &Vec<u32>,
+            #[allow(clippy::ptr_arg)] _s: &String,
+            #[allow(clippy::ptr_arg)] _c: &Cow<[i32]>,
+        ) {
+        }
+    }
+
+    trait T {
+        fn allowed(
+            #[allow(clippy::ptr_arg)] _v: &Vec<u32>,
+            #[allow(clippy::ptr_arg)] _s: &String,
+            #[allow(clippy::ptr_arg)] _c: &Cow<[i32]>,
+        ) {
+        }
+    }
+}