Add `inefficient_to_string` lint
Closes#4586
changelog: Add `inefficient_to_string` lint, which checks for calling `to_string` on `&&str`, which would bypass the `str`'s specialization
Fix ICE in `use_self` lint
The ICE is produced by building this span:
55e7818a06/clippy_lints/src/use_self.rs (L55-L60)
`span` can start in the file the macro is defined in and end where the macro is called.
changelog: Fix ICE in `use_self` lint
new lints around`#[must_use]`
changelog: Add `must_use_candidate` lint, add `must-use-unit` lint, add `double_must_use` lint
The first one checks if an public function or method has no mutable argument and mutates no non-local data and lints if it has no `#[must_use]` attribute. It will skip inner functions, because those are usually highly local and the attribute doesn't have as much benefit there.
The second lints `#[must_use]` attributes on functions and methods that return unit. Those attributes are likely a remnant from a refactoring that removed the return value.
The last one lints for `#[must_use]` attributrs without text on functions that return a type which is already marked `#[must_use]`. This has no auto-suggestion, because while it would be easy to do, there may be value in writing a detailed text for the attribute instead.
This fixes#4526
`must_use_unit` lints unit-returning functions with a `#[must_use]`
attribute, suggesting to remove it.
`double_must_use` lints functions with a plain `#[must_use]`
attribute, but which return a type which is already `#[must_use]`,
so the attribute has no benefit.
`must_use_candidate` is a pedantic lint that lints functions and
methods that return some non-unit type that is not already
`#[must_use]` and suggests to add the annotation.
PR template might not be stripped by contributors
cc d97fbdbb42
So I think it would be better to make the template visible.
Also I renamed the template with extension `.md`.
changelog: none
Lints when, on the RHS of a BinOp, there is a UnOp without a space
before the operator but with a space after (e.g. foo >- 1).
Signed-off-by: Nikos Filippakis <nikolaos.filippakis@cern.ch>