]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/needless_update.rs
Rollup merge of #100462 - zohnannor:master, r=thomcc
[rust.git] / src / tools / clippy / tests / ui / needless_update.rs
1 #![warn(clippy::needless_update)]
2 #![allow(clippy::no_effect)]
3
4 struct S {
5     pub a: i32,
6     pub b: i32,
7 }
8
9 #[non_exhaustive]
10 struct T {
11     pub x: i32,
12     pub y: i32,
13 }
14
15 fn main() {
16     let base = S { a: 0, b: 0 };
17     S { ..base }; // no error
18     S { a: 1, ..base }; // no error
19     S { a: 1, b: 1, ..base };
20
21     let base = T { x: 0, y: 0 };
22     T { ..base }; // no error
23     T { x: 1, ..base }; // no error
24     T { x: 1, y: 1, ..base }; // no error
25 }