summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/field_reassign_with_default.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/field_reassign_with_default.rs')
-rw-r--r--src/tools/clippy/tests/ui/field_reassign_with_default.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/field_reassign_with_default.rs b/src/tools/clippy/tests/ui/field_reassign_with_default.rs
index 7367910ea..1f989bb12 100644
--- a/src/tools/clippy/tests/ui/field_reassign_with_default.rs
+++ b/src/tools/clippy/tests/ui/field_reassign_with_default.rs
@@ -247,3 +247,24 @@ mod issue6312 {
}
}
}
+
+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())();
+}