about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-03-31 16:19:07 +0000
committerbors <bors@rust-lang.org>2021-03-31 16:19:07 +0000
commit775ef473d7770f375c571004a8ca1ae42983937b (patch)
tree70fcd5a3b699af2c704951ec599c784c9b7b5425 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parentc1021b806c086d66019dacdce5ba550a7c460092 (diff)
parent56fbbf7b8fc7c99a6c54dfff6847770a4ed27eb1 (diff)
downloadrust-775ef473d7770f375c571004a8ca1ae42983937b.tar.gz
rust-775ef473d7770f375c571004a8ca1ae42983937b.zip
Auto merge of #6342 - bbqbaron:issue-6061, r=flip1995
Lint: filter(Option::is_some).map(Option::unwrap)

Fixes #6061

*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog:
* add new lint for filter(Option::is_some).map(Option::unwrap)

First Rust PR, so I'm sure I've violated some idioms. Happy to change anything.

I'm getting one test failure locally -- a stderr diff for `compile_test`. I'm having a hard time seeing how I could be causing it, so I'm tentatively opening this in the hopes that it's an artifact of my local setup against `rustc`. Hoping it can at least still be reviewed in the meantime.

I'm gathering that since this is a method lint, and `.filter(...).map(...)` is already checked, the means of implementation needs to be a little different, so I didn't exactly follow the setup boilerplate. My way of checking for method calls seems a little too direct (ie, "is the second element of the expression literally the path for `Option::is_some`?"), but it seems like that's how some other lints work, so I went with it. I'm assuming we're not concerned about, eg, closures that just end up equivalent to `Option::is_some` by eta reduction.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions