]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/tests/ui/field_reassign_with_default.rs
Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyup
[rust.git] / src / tools / clippy / tests / ui / field_reassign_with_default.rs
index 7367910eaa126fdc54319aa3d7232765dcca376d..1f989bb1220525f35807d6d1195ea875707b0e1e 100644 (file)
@@ -247,3 +247,24 @@ fn new(name: &str) -> Self {
         }
     }
 }
+
+struct Collection {
+    items: Vec<i32>,
+    len: usize,
+}
+
+impl Default for Collection {
+    fn default() -> Self {
+        Self {
+            items: vec![1, 2, 3],
+            len: 0,
+        }
+    }
+}
+
+#[allow(clippy::redundant_closure_call)]
+fn issue10136() {
+    let mut c = Collection::default();
+    // don't lint, since c.items was used to calculate this value
+    c.len = (|| c.items.len())();
+}