rust-clippy
rust-clippy copied to clipboard
A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/
### What it does Check that all variants of an enum are used inside a function. This is similar to standard exhaustiveness checking of a `match`, and the [`non-exhaustive-omitted-patterns`](https://github.com/rust-lang/rust/issues/89554) lint...
### What it does The lint would detect cases where the new Option function is_some_and would be appropriate. Examples would be places where `map()` converts an `Option` into an `Option`...
`Arc` only implements `Send`+`Sync` for contained types that are themselves `Send` and `Sync`. So wrapping a non-`Send`/`Sync` type in an Arc won't make it shareable. Using a `Rc` instead could...
### Summary `clippy::to_string_in_format_args` gives incorrect output when you call to_string on a str slice. The code it suggests doesn't compile. ### Reproducer I tried this code: ```rust fn print_substring(original: &str)...
### Summary allowing `unsafe_removed_from_name` on imports produces a false positive on `useless_attribute` ### Lint Name useless_attribute ### Reproducer I tried this code: ```rust #![allow(unused_imports)] #[allow(clippy::unsafe_removed_from_name)] use std::cell::UnsafeCell as Cell; ```...
### What it does Detects the combination of `then_some` followed by `unwrap_or` in place of a more clear `if`/`else`. ### Lint Name bool_if_else ### Category style ### Advantage - Clarity...
There's already `cargo dev` which makes Clippy development easier and more pleasant. This can still be expanded, so that it covers more areas of the development process. Steps to completion:...
### Description [`match_same_arms`](https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms) can suggest merging two `match` arms with identical bodies. If this is done, the fixed arm will merge the other arm into itself, but the old arm...
### Summary When calling `map_or` with a function call as the default value, clippy does not suggest writing it with `map_or_else` instead as it does for the other `or` methods....
### Description [`cast_possible_wrap`](https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap)'s docs currently have an explanation of why this isn't desirable, but do not give the user an alternative to use. I'd like to suggest adding a mention...