summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/field_reassign_with_default.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/tools/clippy/tests/ui/field_reassign_with_default.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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())();
+}