You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One can make a mistake where they mistype = to ==.
Consider the following code:
fnmain(){letmut a = 10;println!("A is {}", a);if1 == 2{
a = 20;}else{
a == 30;// Oops, meant assignment}println!("A is now {}", a);// Still 10}
No warning is produced for this code.
I'd argue that this is a common enough mistake to justify warning by default for it.
If the user explicitly wants to do this operation for side effects or whatever, they can do let _ = a == b;, similarly to the explicit version for #[must_use] types.