about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-09-12 16:09:06 +0000
committerbors <bors@rust-lang.org>2023-09-12 16:09:06 +0000
commitcb057019d46b823f142b6cc201319586e61471a8 (patch)
tree0b643a17bdcf3fa13099363e67906af8a228d99f /compiler/rustc_codegen_llvm/src
parent98363cbf6a7c3f8b571a7d92a3c645bb4376e4a6 (diff)
parentf136e1634a8d834d32deb89273717227eedaf153 (diff)
downloadrust-cb057019d46b823f142b6cc201319586e61471a8.tar.gz
rust-cb057019d46b823f142b6cc201319586e61471a8.zip
Auto merge of #11413 - jonboh:master, r=Alexendoo
new unnecessary_map_on_constructor lint

changelog: [`unnecessary_map_on_constructor`]: adds lint for cases in which map is not necessary. `Some(4).map(myfunction)` => `Some(myfunction(4))`

Closes https://github.com/rust-lang/rust-clippy/issues/6472

Note that the case mentioned in the issue `Some(..).and_then(|..| Some(..))` is fixed by a chain of lint changes. This PR completes the last part of that chain.

By `bind_instead_of_map`[lint](https://rust-lang.github.io/rust-clippy/master/index.html#/bind_instead_of_map):
`Some(4).and_then(|x| Some(foo(4)))` => `Some(4).map(|x| foo)`

By `redundant_closure` [lint](https://rust-lang.github.io/rust-clippy/master/index.html#/redundant_closure):
`Some(4).map(|x| foo)` => `Some(4).map(fun)`

Finally by this PR `unnecessary_map_on_constructor`:
`Some(4).map(fun)` => `Some(fun(4))`

I'm not sure this is the desired behavior for clippy and if it should be addressed in another issue/PR. I'd be up to give it a try if that's the case.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions