bors 775ef473d7 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.
2021-03-31 16:19:07 +00:00
..
2021-01-07 18:54:12 -03:00
2020-11-08 18:32:12 -05:00
2021-03-29 16:10:37 -04:00
2021-03-29 16:10:37 -04:00
2021-03-29 16:10:37 -04:00
2021-03-28 07:54:00 -04:00
2021-03-28 07:54:00 -04:00
2020-11-08 18:32:12 -05:00
2020-11-08 18:32:12 -05:00
2020-11-08 18:32:12 -05:00
2021-03-26 20:19:34 +09:00
2021-03-26 20:19:34 +09:00
2021-03-16 19:56:47 +09:00
2021-03-16 19:56:47 +09:00
2020-11-08 18:32:12 -05:00
2021-03-25 22:30:14 -04:00
2020-11-08 18:32:12 -05:00
2020-11-08 18:32:12 -05:00
2021-03-26 20:19:34 +09:00
2021-03-03 11:23:29 +01:00