rust-clippy/tests/ui/multi_assignments.rs

17 lines
573 B
Rust
Raw Normal View History

2022-08-26 07:16:41 +00:00
#![warn(clippy::multi_assignments)]
fn main() {
let (mut a, mut b, mut c, mut d) = ((), (), (), ());
a = b = c;
//~^ ERROR: assignments don't nest intuitively
//~| NOTE: `-D clippy::multi-assignments` implied by `-D warnings`
2022-08-26 07:16:41 +00:00
a = b = c = d;
//~^ ERROR: assignments don't nest intuitively
//~| ERROR: assignments don't nest intuitively
2022-08-26 07:16:41 +00:00
a = b = { c };
//~^ ERROR: assignments don't nest intuitively
2022-08-26 07:16:41 +00:00
a = { b = c };
//~^ ERROR: assignments don't nest intuitively
2022-08-26 07:16:41 +00:00
a = (b = c);
//~^ ERROR: assignments don't nest intuitively
2022-08-26 07:16:41 +00:00
}