]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/map_clone.fixed
iterate List by value
[rust.git] / tests / ui / map_clone.fixed
index 228671ca2097ec71857f4d784ac32aa1388fbf10..81c7f659efb1fed41dbbd9433b9dd5a8c3d79ffe 100644 (file)
@@ -1,9 +1,10 @@
 // run-rustfix
 #![warn(clippy::all, clippy::pedantic)]
 #![allow(clippy::iter_cloned_collect)]
-#![allow(clippy::clone_on_copy)]
+#![allow(clippy::clone_on_copy, clippy::redundant_clone)]
 #![allow(clippy::missing_docs_in_private_items)]
-#![allow(clippy::redundant_closure)]
+#![allow(clippy::redundant_closure_for_method_calls)]
+#![allow(clippy::many_single_char_names)]
 
 fn main() {
     let _: Vec<i8> = vec![5_i8; 6].iter().copied().collect();
@@ -23,4 +24,24 @@ fn main() {
 
     // Issue #498
     let _ = std::env::args();
+
+    // Issue #4824 item types that aren't references
+    {
+        use std::rc::Rc;
+
+        let o: Option<Rc<u32>> = Some(Rc::new(0_u32));
+        let _: Option<u32> = o.map(|x| *x);
+        let v: Vec<Rc<u32>> = vec![Rc::new(0_u32)];
+        let _: Vec<u32> = v.into_iter().map(|x| *x).collect();
+    }
+
+    // Issue #5524 mutable references
+    {
+        let mut c = 42;
+        let v = vec![&mut c];
+        let _: Vec<u32> = v.into_iter().map(|x| *x).collect();
+        let mut d = 21;
+        let v = vec![&mut d];
+        let _: Vec<u32> = v.into_iter().map(|&mut x| x).collect();
+    }
 }