summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/needless_update.rs
blob: bfa005a19f91073c5c31552f22a295b97975f9b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#![warn(clippy::needless_update)]
#![allow(clippy::no_effect)]

struct S {
    pub a: i32,
    pub b: i32,
}

fn main() {
    let base = S { a: 0, b: 0 };
    S { ..base }; // no error
    S { a: 1, ..base }; // no error
    S { a: 1, b: 1, ..base };
}