As discovered by @mikerite, we currently don't run the pedantic lints over the clippy codebase.
There were about 70 warnings on Travis when it was enabled.
List of warnings to fix:
if letif let1_000_000_000.0 between ticks in the documentationvar_arg between ticks in the documentationmatch has identical arm bodiesfilter(p).map(q) on an Iterator. This is more succinctly expressed by calling .filter_map(..) instead.if letfilter(p).map(q) on an Iterator. This is more succinctly expressed by calling .filter_map(..) instead.So I was taking a look at fixing the various casting warnings, and I was wondering what the "right" way to address them is. For cast_possible_truncation, the casts can be replaced with a try_into().expect(...), which is easy enough. But for cast_sign_loss / cast_possible_wrap, the situation is a little trickier, because often we are doing something clever with the bits and it's fine for it to wrap. So what's the right way to express that it's okay to e.g. cast a i128 to a u128 and back in utils::{sext, unsext}? Should I just #[allow] these lints in these cases?
Yeah, pedantic lints typically have a healthy helping of allow. If the "fix" isn't really improving things, just allow it.
Just tried again running clippy with -W clippy::pedantic on the clippy code base. Now it produces new warnings:
filter(p).map(q) on an Iterator. This is more succinctly expressed by calling .filter_map(..) instead.I have a wip branch for some of these, should get PR done soonish.
Most helpful comment
I have a wip branch for some of these, should get PR done soonish.