In this case, the lint can be triggered as well as `is_empty()` will be
found on the target type.
One such case was found in Clippy sources (first commit)
changelog: [`len_zero`]: trigger if deref target implements `is_empty()`
Close#13861
Using `lifetime.ident.name` in suggestions will not output the raw
modifier. For example, `'r#struct` will be rendered as `'struct` which
would be incorrect.
Fix#13899
changelog: [`needless_arbitrary_self_type`]: use the raw lifetime name
in suggestions
Proper parentheses need to be added to some expressions in receiver
position.
Fix#13902
changelog: [`redundant_pattern_matching`]: use proper parentheses when
suggesting replacing `matches!(…, None)` by `.is_none()`
I discovered that there were paths declared in `clippy_utils::paths` in
https://github.com/rust-lang/rust-clippy/pull/13829 so moving a few
remaining hardcoded ones in one place.
changelog: Move more def paths into `clippy_utils::paths`
r? @y21
Using `lifetime.ident.name` in suggestions will not output the raw
modifier. For example, `'r#struct` will be rendered as `'struct` which
would be incorrect.
Also, simplify boolean shortcut expression, and ensure that
applicability is properly applied, as it was ignored and
`MachineApplicable` was always used.
changelog: [`borrow_as_ptr`]: do not remove required parentheses in
autofix suggestion
Close#13882
This PR just makes sure that we exit the function before getting an ICE
and adds a regression test. Related to #12979. We would need to keep
researching the issue, but as the ICEing code isn't that complicated,
getting a hotfix into nightly is urgent.
changelog:[`borrow_interior_mutable_const`] Fix ICE #12979
Fixes#13862
`missing_headers::check` is sometimes called from outside of a body
(specifically, from `check_attributes`, where the LateContext's ParamEnv
is not yet properly initialized for that item). Using that empty
ParamEnv for trait solving things from within the body can then lead to
various ICEs, like the linked issue where we have a const generic
parameter `DMA_INST` without a `ConstArgHasType` bound in the ParamEnv
so the const parameter has no type, which is normally not supposed to
happen.
We have the item's DefId so we can just get its ParamEnv/TypingEnv from
there, and using that one for trait solving should be safe.
changelog: none
Convert the ICE reported in #12979 into a false negative.
We prefer a false negative to a ICE (because the ICE could
still affect the user even when not activating the lint).
Fixes#11846.
This PR has three commits:
- The first commit adds an `initializer-suggestions` configuration to
control suggestion applicability when initializers are present. The
following are the options:
- "none": do not suggest
- "maybe-incorrect": suggest, but do not apply suggestions with `--fix`
- "machine-applicable": suggest and apply suggestions with `--fix`
- The second commit fixes suggestions to handle field attributes
(problem [noticed by
@samueltardieu](https://github.com/rust-lang/rust-clippy/pull/13737#discussion_r1859261645)).
- The third commit adds `initializer-suggestions = "machine-applicable"`
to Clippy's `clippy.toml` and applies the suggestions. (Nothing seems to
break.)
---
changelog: make `inconsistent_struct_constructor` "all fields are
shorthand" requirement configurable
fix#13843
The `manual_div_ceil` lint makes incorrect suggestion when type suffixes
need to be made explicit in the suggested code.
changelog: [`manual_div_ceil`]: suggested code now includes appropriate
type suffixes where necessary
fix#13411
The `if_not_else` lint can be fixed automatically, but the issue above
reports that there is no implementation to do so. Therefore, this PR
implements it.
----
changelog: [`if_not_else`]: make suggestions for modified code
Begin to implement type system layer of unsafe binders
Mostly TODOs, but there's a lot of match arms that are basically just noops so I wanted to split these out before I put up the MIR lowering/projection part of this logic.
r? oli-obk
Tracking:
- https://github.com/rust-lang/rust/issues/130516
cleanup region handling: add `LateParamRegionKind`
The second commit is to enable a split between `BoundRegionKind` and `LateParamRegionKind`, by avoiding `BoundRegionKind` where it isn't necessary.
The third comment then adds `LateParamRegionKind` to avoid having the same late-param region for separate bound regions. This fixes#124021.
r? `@compiler-errors`
It is related to https://github.com/rust-lang/rust-clippy/issues/13099
What was done:
- removed `@no-rustfix` from `tests/ui/unnecessary_to_owned.rs`
- checked for suggestions in `src/methods/unnecessary_to_owned.rs`
(there is already one multipart_suggestion, and I don't see any other)
- ran `cargo uibless`
I am new to Rust, and this is my first PR.
changelog: none