]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/needless_borrow.rs
Auto merge of #4478 - tsurai:master, r=flip1995
[rust.git] / tests / ui / needless_borrow.rs
index 088d33b875f968b4bd3b0510910d56d0b4f00977..d4ac2b89854df471f2f4a1e79706f894540eaae0 100644 (file)
@@ -1,11 +1,11 @@
 use std::borrow::Cow;
 
-
+#[allow(clippy::trivially_copy_pass_by_ref)]
 fn x(y: &i32) -> i32 {
     *y
 }
 
-#[warn(clippy)]
+#[warn(clippy::all, clippy::needless_borrow)]
 #[allow(unused_variables)]
 fn main() {
     let a = 5;
@@ -29,7 +29,7 @@ fn main() {
     };
 }
 
-fn f<T:Copy>(y: &T) -> T {
+fn f<T: Copy>(y: &T) -> T {
     *y
 }
 
@@ -41,8 +41,8 @@ trait Trait {}
 
 impl<'a> Trait for &'a str {}
 
-fn h(_: &Trait) {}
-
+fn h(_: &dyn Trait) {}
+#[warn(clippy::needless_borrow)]
 #[allow(dead_code)]
 fn issue_1432() {
     let mut v = Vec::<String>::new();
@@ -53,10 +53,8 @@ fn issue_1432() {
 }
 
 #[allow(dead_code)]
-fn test_cow_with_ref(c: &Cow<[i32]>) {
-}
-
-#[allow(dead_code)]
-fn test_cow(c: Cow<[i32]>) {
-    let _c = c;
+#[warn(clippy::needless_borrow)]
+#[derive(Debug)]
+enum Foo<'a> {
+    Str(&'a str),
 }