mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
42796e11c5
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 |
||
---|---|---|
.. | ||
auxiliary | ||
cargo | ||
ui | ||
ui-toml | ||
compile-test.rs | ||
dogfood.rs | ||
fmt.rs | ||
integration.rs | ||
matches.rs | ||
missing-test-files.rs | ||
versioncheck.rs |