Detects manual implementations of the newly implemented
[`BinaryHeap::pop_if()`](https://github.com/rust-lang/rust/issues/151828)
in `manual_pop_if`.
I wasn't sure about how best to handle checking for the nightly feature.
Could we let people compiling with nightly know that the feature is
available even if they don't have it enabled?
changelog: [`manual_pop_if`]: detect manual implementations of
`BinaryHeap::pop_if()`
Closes: rust-lang/rust-clippy#16654
changelog: [`question_mark`]: fix suggestion-caused-error caused by
semicolon inference relying only on parent-node shape.
The wrong `TypeckResults` was used in the fallback equality function
passed by the `match_same_arms` and `filter_map` lints. Previously,
those fallback functions had no way of using the proper `TypeckResults`.
Those (one per expression being compared) are now passed to the
registered fallback function.
Add a lint to detect when the recently added Vec::pop_if,
VecDeque::pop_front_if, and VecDeque::pop_back_if are manually
implemented.
changelog: add [`manual_pop_if`] lint
Fixrust-lang/rust-clippy#16155
Suppress the `-> !` suggestion when the loop is inside a conditional
where not all branches diverge. When every branch does diverge (e.g. `if
cond { loop {} } else { loop {} }`), the suggestion is still emitted.
changelog: [`infinite_loop`]: Fix wrong suggestion to add `-> !` when
the loop is inside a conditional branch
FIxesrust-lang/rust-clippy#16482
changelog: [`doc_paragraphs_missing_punctuation`]: fix: No longer lints
for punctuated paragraphs with a trailing emoji.
core: make atomic primitives type aliases of `Atomic<T>`
Tracking issue: https://github.com/rust-lang/rust/issues/130539
This makes `AtomicI32` and friends type aliases of `Atomic<T>` by encoding their alignment requirements via the use of an internal `Storage` associated type. This is also used to encode that `AtomicBool` store a `u8` internally.
Modulo the `Send`/`Sync` implementations, this PR does not move any trait implementations, methods or associated functions – I'll leave that for another PR.
Fixesrust-lang/rust-clippy#16411
`core::panic` was missing in the formatting arg lints
changelog: fix all format-related lints to handle `core::panic!` macro
Closesrust-lang/rust-clippy#16448Closesrust-lang/rust-clippy#16564
The previous implementation hardcoded bans on `str` to avoid adding `*`
when comparing with `String`, which becomes a problem for `Pathbuf` as
`PartialEq<&str>` is not yet implemented on it.
changelog: [`cmp_owned`] fix wrong suggestions on `PathBuf`
In this approach, we're using the `CARGO_BIN_EXE_clippy-driver` env var, which is set to the appropriate absolute path,
invariant across the various possible `target-dir` and `build.build-dir` configurations.
Do the same for `CARGO_CLIPPY_PATH` in tests/test_utils/mod.rs.
Closesrust-lang/rust-clippy#16612
Previous implementation hardcoded `0` as loop counter start, this PR
lifts that restriction.
changelog: [`explicit_counter_loop`] fix FN when loop counter starts at
non-zero
changelog: [`borrow_deref_ref`]: do not suggest removing an explicit
reborrow when it targets an upvar captured by a closure
Fixesrust-lang/rust-clippy#16556
r? Jarcho
This matches `cargo fmt` behavior but for `format!(...)` -style macro
calls.
To make this PR easier to review, it moves all linting of the clippy
code to rust-lang/rust-clippy#16533
Suggest removing an unnecessary trailing comma before the closing
parenthesis in single-line format-like macro invocations (e.g. println!,
format!, write!). The lint currently only runs on format-like macros
because it relies on format-argument parsing; arbitrary user macros are
not supported to avoid incorrect suggestions.
- Lint is in the `style` group (allow-by-default)
- Single-line only: multi-line macro invocations are not linted
- Machine-applicable fix: removes the trailing comma
```rust
// catches this
debug!("Foo={}", 1,);
// suggests this
debug!("Foo={}", 1);
```
Closesrust-lang/rust-clippy#13965
changelog: [`unnecessary_trailing_comma`]: new lint to remove trailing
commas in a single-line format macro usage