Now that `if let` chains have been introduced, the `if_chain` external
crate is no longer necessary. Dropping special support for it also
alleviates the need to keep the crate as a dependency in tests.
This is a cleanup PR.
changelog: none
When an expression is made of a `!` or `-` unary operator which does not
change the type of the expression, use a new variant in `Sugg` to denote
it. This allows replacing an extra application of the same operator by
the removal of the original operator instead.
Some suggestions will now be shown as `x` instead of `!!x`. Right now,
no suggestion seems to produce `--x`.
changelog: none
When an expression is made of a `!` or `-` unary operator which does not
change the type of the expression, use a new variant in `Sugg` to denote
it. This allows replacing an extra application of the same operator by
the removal of the original operator instead.
Also, when adding a unary operator to a suggestion, do not enclose the
operator argument in parentheses if it starts with a unary operator
itself unless it is a binary operation (including `as`), because in this
case parentheses are required to not bind the lhs only.
Some suggestions will now be shown as `x` instead of `!!x`. Right now,
no suggestion seems to produce `--x`.
When a bare CR is present in a four slashes comment, keep triggering the
lint but do not issue a fix suggestion as bare CRs are not supported in
doc comments. An extra note is added to the diagnostic to warn the user
about it.
I have put the test in a separate file to make it clear that the bare CR
is not a formatting error.
Fixesrust-lang/rust-clippy#15174
changelog: [`four_forward_slashes`]: warn about bare CR in comment, and
do not propose invalid autofix
Now that `if let` chains have been introduced, the `if_chain` external
crate is no longer necessary. Dropping special support for it also
alleviates the need to keep the crate as a dependency in tests.
Closesrust-lang/rust-clippy#15348
The span of the `as` expr is also incorrect, but I believe it is not a
bug from Clippy.
changelog: [`cast-lossless`] fix wrong suggestions when casting type is
from macro input
don't link to the nightly version of the Edition Guide in stable lints
As reported in rust-lang/rust#143557 for `rust_2024_incompatible_pat`, most future-Edition-incompatibility lints link to the nightly version of the Edition Guide; the lints were written before their respective Editions (and their guides) stabilized. But now that Rusts 2021 and 2024 are stable, these lints are emitted on stable versions of the compiler, where it makes more sense to present users with links that don't say "nightly" in them.
This does not change the link for `rust_2024_incompatible_pat`. That's handled in rust-lang/rust#144006.