cc rust-lang/rust#148190 @flip1995 @RalfJung
This is a bit of a hack in that it hardcodes the list of crates with
stability attributes. This shouldn't be a big deal since that isn't a
set that changes very frequently and an internal lint could detect when
that happens.
The `fixme`s added aren't new issues and shouldn't get in the way of
unblocking the upstream issue.
changelog: none
Fixrust-lang/rust-clippy#15943
```rust
pub fn from_days(days: u8) -> Duration {
Duration::from_secs(86400 * u64::from(days))
}
```
An initial foundation that can be used for future improvements. It is
been a while since I touched Clippy so feel free to indicate better
designs if applicable.
Looks like https://github.com/rust-lang/rust-clippy/pull/15342 will help
but it is unclear when it will be finished. This PR provides a partial
solution for the current time.
changelog: [`arithmetic_side_effects`]: Consider type conversion that
won't overflow
Now only tokenizes the contents of code blocks instead of spawning a
thread for a full parser
The language tag handling now correctly picks up things like `rust,
ignore`
`no_test` (rust-lang/rust-clippy#10491) is no longer specially handled,
rustdoc considers `rust,no_test` to be a regular test
changelog: [`needless_doctest_main`], [`test_attr_in_doctest`]: now
handles whitespace in language tags
When matched against `Result` with copyable `Ok` variant, uncopyable
scrutinee won't actually be moved. But
`manual_unwrap_or`/`manual_unwrap_or_default` will force it to move,
which can cause problem if scrutinee is used later.
Fixesrust-lang/rust-clippy#15807
changelog: [`manual_unwrap_or`]: don't lint if not safe to move
scrutinee
changelog: [`manual_unwrap_or_default`]: don't lint if not safe to move
scrutinee
Previously the program only fixed the code when the closure supplied to
the method contained only 1 line. This patch removes the restriction.
The code already works. This patch only removes the extra check that
causes the restriction. The test cases that can now be fixed are moved
into the files containing tests cases that can be fixed.
The unnecessary check has survived in the code this way.
- In Dec 2015, patch a6bd2d0622, pull request
rust-lang/rust-clippy#524. The lint was first added. The program did not
support fixing code automatically yet. So the suggested fix was printed
as a part of the diagnostic message. When the original code contained
multiple lines, the suggested fix was omitted in order to keep the
diagnostic message concise.
- In May 2019, patch bd0b75f6c3, pull request
rust-lang/rust-clippy#4049. Logic was added to strip the reference in
the closure when the suggested replacement method required it. Because
the fix was still only printed when the code contained a single line,
the new transformation was only done when the code contained a single
line.
- In Aug 2019, patch 945d4cf69f, pull request
rust-lang/rust-clippy#4454. The lint was updated to fix code
automatically. Because the fixed code had only been printed in the
diagnostic message for a single line, the fix was only added for a
single line.
- In Nov 2021, patch 092fe209a6, pull request
rust-lang/rust-clippy#7463. The logic for transforming the closure was
moved into another file. A comment was added saying that it was only
good for a single line because it had only been used for a single line.
changelog: [`search_is_some`] now fixes code spanning multiple lines