There are cases where the closure call is needed in some macros, this in
particular occurs when the closure has parameters. To handle this case,
we allow the lint when there are no parameters in the closure, or the
closure is outside a macro invocation.
fixes: #11274, #1553
changelog: FP: [`redundant_closure_call`] when closures with parameters
are passed in macros.
Improve help message for `search_is_some` lint
Fixes#11681.
Like mentioned in the issue, we tend to use the formulation "consider using", which we didn't in this case. I think it clears both the confusion and also makes help message more coherent overall.
r? `@llogiq`
changelog: Improve help message for `search_is_some` lint
Fix false positive in `PartialEq` check in `unconditional_recursion` lint
Fixes https://github.com/rust-lang/rust-clippy/issues/12133.
We needed to check for the type of the previous element <del>in case it's a field</del>.
EDIT: After some extra thoughts, no need to check if it's a field, just if it's the same type as `Self`.
r? `@llogiq`
changelog: Fix false positive in `PartialEq` check in `unconditional_recursion` lint
Fix suggestion for `map_clone` lint on types implementing `Copy`
Follow-up of https://github.com/rust-lang/rust-clippy/pull/12104.
It was missing this check to suggest the correct method.
r? `@llogiq`
changelog: Fix suggestion for `map_clone` lint on types implementing `Copy`
I'm not on vacation (again)
A few weeks ago I opened #12011 removing me from `users_on_vacation`, it got merged. The subtree sync reverted this change (weirdly)
changelog: none
r? `@xFrednet`
Remove giraffate from the reviewer rotation
I've been less active in Clippy recently because I'm so busy that I don't have time for maintaining Clippy in my spare time. So, I remove myself from the reviewer rotation once. I hope to come back again.
I'll reassign the PRs later.
changelog: none
One consequence is that errors returned by
`maybe_new_parser_from_source_str` now must be consumed, so a bunch of
places that previously ignored those errors now cancel them. (Most of
them explicitly dropped the errors before. I guess that was to indicate
"we are explicitly ignoring these", though I'm not 100% sure.)
Extend `useless_asref` lint on `map(clone)`
If you have code like:
```rust
Some(String::new()).as_ref().map(Clone::clone)
```
the `as_ref` call is unneeded.
Interestingly enough, this lint and `map_clone` are starting to share a same "space" where both lints warn about different things for the same code. Not sure what's the policy about such cases though...
r? `@llogiq`
changelog: Extend `useless_asref` lint on `map(clone)`
In #119606 I added them and used a `_mv` suffix, but that wasn't great.
A `with_` prefix has three different existing uses.
- Constructors, e.g. `Vec::with_capacity`.
- Wrappers that provide an environment to execute some code, e.g.
`with_session_globals`.
- Consuming chaining methods, e.g. `Span::with_{lo,hi,ctxt}`.
The third case is exactly what we want, so this commit changes
`DiagnosticBuilder::foo_mv` to `DiagnosticBuilder::with_foo`.
Thanks to @compiler-errors for the suggestion.