Downgrade option_option to pedantic
Based on a search of my work codebase (\>500k lines) for `Option<Option<`, it looks like a bunch of reasonable uses to me. The documented motivation for this lint is:
> an optional optional value is logically the same thing as an optional value but has an unneeded extra level of wrapping
which seems a bit bogus in practice. For example a typical usage would look like:
```rust
let mut host: Option<String> = None;
let mut port: Option<i32> = None;
let mut payload: Option<Option<String>> = None;
for each field {
match field.name {
"host" => host = Some(...),
"port" => port = Some(...),
"payload" => payload = Some(...), // can be null or string
_ => return error,
}
}
let host = host.ok_or(...)?;
let port = port.ok_or(...)?;
let payload = payload.ok_or(...)?;
do_thing(host, port, payload)
```
This lint seems to fit right in with the pedantic group; I don't think linting on occurrences of `Option<Option<T>>` by default is justified.
---
changelog: Remove option_option from default set of enabled lints
Lint unnamed address comparisons
Functions and vtables have an insignificant address. Attempts to compare such addresses will lead to very surprising behaviour. For example: addresses of different functions could compare equal; two trait object pointers representing the same object and the same type could be unequal.
Lint against unnamed address comparisons to avoid issues like those in rust-lang/rust#69757 and rust-lang/rust#54685.
changelog: New lints: [`fn_address_comparisons`] [#5294](https://github.com/rust-lang/rust-clippy/pull/5294), [`vtable_address_comparisons`] [#5294](https://github.com/rust-lang/rust-clippy/pull/5294)
`unused_self` false positive
fixes#5351
Remove the for loop in `unused_self` so that lint enabled for one method doesn't trigger on another method.
changelog: Fix false positive in `unused_self` around lint gates on impl items
Move verbose_file_reads to restriction
cc #5368
Using `File::read` instead of `fs::read_to_end` does make sense in multiple cases, so this lint is rather restriction, than complexity
changelog: Move [`verbose_file_reads`] to restriction
Lint for `pub(crate)` items that are not crate visible due to the visibility of the module that contains them
changelog: Add `redundant_pub_crate` lint
Closes#5274.
Fix single binding closure
Fix the `match_single_binding` lint when triggered inside a closure.
Fixes: #5347
changelog: Improve suggestion for [`match_single_binding`]
Improvement: Don't show function body in needless_lifetimes
Changes the span on which the lint is reported to point to only the
function return type instead of the entire function body.
Fixes#5284
changelog: none
Extend `redundant_clone` to the case that cloned value is not consumed
Fixes#5303.
---
changelog: Extend `redundant_clone` to the case that cloned value is not consumed
add lint on File::read_to_string and File::read_to_end
Adds lint `verbose_file_reads` which checks for use of File::read_to_end and File::read_to_string.
Closes https://github.com/rust-lang/rust-clippy/issues/4916
changelog: add lint on File::{read_to_end, read_to_string}
redundant_pattern: take binding (ref, ref mut) into account in suggestion
fixes#5271
changelog: redundant_pattern: take binding (ref, ref mut) into account in suggestion (#5271)
Fix match single binding when in a let stmt
Fix bad suggestion when `match_single_binding` lints when inside a local (let) statement.
Fixes#5267
changelog: none
Resolve false positives of unnecessary_cast for non-decimal integers
This PR resolves false positives of `unnecessary_cast` for hexadecimal integers to floats and adds a corresponding test case.
Fixes: #5220
changelog: none
Add lint for .. use in fully binded struct
This PR adds the lint `match-wild-in-fully-binded-struct` to prevent the use of the `..` pattern when all fields of the struct are already binded.
Fixes: #638
changelog: Add [`rest_pat_in_fully_bound_structs`] lint to warn against the use of `..` in fully binded struct
Detect usage of custom floating-point abs implementation
Closes#5224
changelog: Enhance [`suboptimal_flops`] lint to detect manual implementations of the `abs` method