Items such as the `declare_tool_lint!()` macro are publicly reexported
from `rustc_lint_defs` to `rustc_session`. Use the latter for
consistency.
changelog: none
Fixes#13793.
Interestingly enough, to actually check that the macro call has at least
two arguments, we need to use the rust lexer after getting the original
source code snippet.
changelog: Add new `useless_concat` lint
It is not enough to check if an expression type implements `Drop` to
determine whether it can have a significant side-effect.
Also, add tests for unchecked cases which were explicitly handled in the
code, such as checking for side effect in a `struct`'s fields, or in its
base expression.
Fixrust-lang/rust-clippy#14592
changelog: [`no_effect_underscore_binding`]: do not propose to remove
the assignment of an object if dropping it might indirectly have a
visible side effect
Do not attempt to fetch a snippet from expansion. Without this change,
the inside of macros could[*] be shown as the source of the problem.
[*] Due to the way the source code is processed and reparsed in this
macro, the declarative macro has to be located outside the current
source file for the bug to appear. Otherwise, the macro call itself will
be (mis)identified as a potential `struct` field definition and the lint
will not trigger.
changelog: [`empty_struct_with_brackets`]: do not lint code coming from
macro expansion
A representation attribute `#[repr(…)]` might indicate that the ordering
of the fields or the variants is dictated by the API the code is
interfacing with. Better not lint with `arbitrary_source_item_ordering`
in this case.
changelog: [`arbitrary_source_item_ordering`]: do not lint inside items
with `#[repr]` attribute
fixes#12979fixes#12951fixes#13233
Tests still need to be finished and the docs still need to be updated,
but this should otherwise ready.
changelog: Lint `declare_interior_mutable_const` and
`borrow_interior_mutable_const` more precisely
Was disabled in rust-lang/rust-clippy#10855 due to a broken suggestion.
This will only lint if a type is not proveded (e.g. `T::deref`).
changelog: none
Using the function declaration, by stripping the body, is enough to
convey the lint message.
changelog: [`unnecessary_wraps`]: do not include the whole body in the
lint span
Closesrust-lang/rust-clippy#14773
* rename test files inside directories and ui-toml tests
* rename tests prefixed with the lint's name
* better module path renaming when renaming the lint's module
* partially delete lint files when uplifting
* rename ui_test error markers
Clippy should not lint 2 blocks expression for comparison_chain.
Fixesrust-lang/rust-clippy#4725
changelog: [`comparison_chain`]: do not lint 2 blocks expression