]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/redundant_clone.rs
iterate List by value
[rust.git] / tests / ui / redundant_clone.rs
index a9b31183adc86b20095cc3d2b62c82bf865f8000..839747b131d77da22c7d559d0133f7006bd2d246 100644 (file)
@@ -51,6 +51,7 @@ fn main() {
     cannot_move_from_type_with_drop();
     borrower_propagation();
     not_consumed();
+    issue_5405();
 }
 
 #[derive(Clone)]
@@ -160,3 +161,12 @@ fn not_consumed() {
         println!("{}", x);
     }
 }
+
+#[allow(clippy::clone_on_copy)]
+fn issue_5405() {
+    let a: [String; 1] = [String::from("foo")];
+    let _b: String = a[0].clone();
+
+    let c: [usize; 2] = [2, 3];
+    let _d: usize = c[1].clone();
+}