By default, edition 2024 will capture all types and lifetimes present in
the function signature when using RPIT, while edition 2021 will capture
only the lifetimes present in the RPIT itself. Adding explicit `use<>`
markers will disable the edition-specific automatic rules when they
differ.
It's either unneeded (`warn`/`deny`) or can be replaced by individual
lints (`allow`). Also removes some redundant `allow`s covered by the
default `-Aunused` that I saw along the way
changelog: none
`unsafe_fields` is an incomplete feature; comments have been put near
`#![expect(incomplete_features)]` to ensure that we revisit the
situation when the feature becomes complete.
changelog: [`expl_impl_clone_on_copy`]: do not lint in the presence of
`unsafe` fields
Fixes#14558
This prevents forgotten `dbg!()` calls from entering Clippy codebase by
mistake.
Suggested by @y21 when one of my PR forgot to remove one `dbg!()` call.
changelog: none
Blocks created by desugaring will not contain an explicit `return`. Do
not suggest to add it when the user has no control over the desugared
code.
Also, ensure that in a `xxx.await` expression, the suggested `return` is
emitted before the whole expression, not before the `await` keyword.
Fix#14411
changelog: [`implicit_return`]: fix proposed `return` position in the
presence of asynchronous code
`Option<Symbol>` is a much nicer and idiomatic way of representing "no
name" using empty symbols. And it works naturally for the item ordering
checking because `None < Some(_)` just like the empty string compares
less than all non-empty strings.
changelog: none
There were two bugs here. Let's assume `T` is a singleton type
implementing `Default` and that `f()` takes a `T`:
- `f(<T>::default())` cannot be replaced by `f(<T)` as it was (incorrect
spans – this is tricky because the type relative path uses a base span
covering only `T`, not `<T>`) (third commit)
- The argument of `f(<_>::default())` is inferred correctly, but cannot
be replaced by `<_>` or `_`, as this cannot be used to infer an instance
of a singleton type (first commit).
The second commit offers better error messages by pointing at the whole
expression.
Fix#12654
changelog: [`default_constructed_unit_struct`]: do not suggest incorrect
fix when using a type surrounded by brackets
`non_canonical_partial_ord_impl` will now recognize two forms of
canonical implementations: `Some(self.cmp(other))` and
`self.cmp(other).into()`.
changelog: [`non_canonical_partial_ord_impl`]: recognize
`self.cmp(other).into()` as a canonical implementation of
`PartialOrd::partial_cmp()`.
Fixesrust-lang/rust-clippy#13640
Fixes rust-lang/rust-clippy#14449, introduced in #14314
changelog: [`map_entry`]: fix a false positive where the lint would
trigger without any insert calls present
changelog: [`manual_abs_diff`]: Initial implementation
Hey, first time writing a new lint for clippy, hope I got it right. I
think it's pretty self-explanatory!
Added a few `fixme` test cases, where the lint can be improved to catch
more (probably rare) patterns, but opening a PR with this initial
implementation to make sure I'm on the right track, and that this lint
is acceptable at all.
😁
Straight from triagebot's documentation, this should allow the bot to
set and remove the `S-waiting-on-author` and `S-waiting-on-review`
labels when a PR author requests a review, or when a review is done with
changes requested.
We do not want to remove casts done inside macros. Also, when printing
the suggestion, take it from the same context as the origin expression
(the root context).
Problems found while working on #14526, but should be merged even if
#14526 is not.
changelog: none
This PR enables to the canonicalization of issue links in triagebot.
Documentation pending at
https://github.com/rust-lang/rust-forge/pull/825
changelog: add `[canonicalize-issue-links]` in `triagebot.toml`
This PR fixes issues with the `missing_asserts_for_indexing` lint.
- false positive when the first index is the highest(or equal) value in
a list of indexes:
```rust
pub fn foo(slice: &[i32]) -> i32{
slice[1] * slice[0]
}
```
- false negative when an assert statement if found after the indexing
operation.
```rust
pub fn bar(slice: &[i32]) -> i32 {
let product = slice[0] * slice[1];
assert!(slice.len() > 1);
product
}
```
examples: https://godbolt.org/z/s7Y47vKdEcloses: #14079
changelog: [`missing_asserts_for_indexing`]: ignore asserts found after
indexing, and do not require asserts if the first index is highest.
`unsafe_fields` is an incomplete feature; comments have been put near
`#![expect(incomplete_features)]` to ensure that we revisit the
situation when the feature becomes complete.