diff options
| author | bors <bors@rust-lang.org> | 2020-04-01 21:30:24 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-04-01 21:30:24 +0000 |
| commit | 42796e11c5187be4e2ad962db17f333a52c3a88a (patch) | |
| tree | 9c90acdedaf26870647399242b2cc26bba147445 /src/rustllvm/CoverageMappingWrapper.cpp | |
| parent | 326b22048a6305d7c918b748be1c081468917ac6 (diff) | |
| parent | f6e8da81f184efb4036db16940ef3bfc84a29984 (diff) | |
| download | rust-42796e11c5187be4e2ad962db17f333a52c3a88a.tar.gz rust-42796e11c5187be4e2ad962db17f333a52c3a88a.zip | |
Auto merge of #5401 - dtolnay:option, r=Manishearth
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
Diffstat (limited to 'src/rustllvm/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
