Hey,
I just found a bug in a project where, instead of doing:
// Making sure that the length of a is equal to 1
if a.len() != 1 {
return Err(...);
}
they did:
// Making sure that the length of a is equal to 1
if !a.len() == 1 {
return Err(...);
}
!a.len()
returned the bitwise negation of a, effectively never returning the error unless a.len() == !1_usize.
(Neither the compiler nor cargo clippy return a warning, so no one noticed until now)
I was wondering, has it ever been discussed to introduce a different symbol for bitwise negation, such as ~
in C?