Rust has several operators that cannot be chained (==
, <
for example).
But the assignment operator =
can be chained.
a = b = 10;
In this case, 10 is assigned to b
, and unit ()
is assigned to a
.
Is there any reason why Rust allows us to chain =
like this?
I created Clippy issue 6576 about this.
question from:https://stackoverflow.com/questions/65661530/why-can-the-assignment-operator-be-chained-in-rust