-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
Summary
The new-ish multiple-bound-locations lint fires on unfixable code.
Lint Name
multiple-bound-locations
Reproducer
I tried this code:
pub fn remove<Q: ?Sized>(&mut self, k: &Q) -> Option<V>
where
K: Borrow<Q>,
Q: Hash + Eq,
{
for i in 0..self.entries.len() {
if self.entries[i].0.borrow() == k {
return Some(self.entries.swap_remove(i).1);
}
}
None
}
I saw this happen:
warning: bound is defined in more than one place
--> tokio-stream/src/stream_map.rs:470:19
|
470 | pub fn remove<Q: ?Sized>(&mut self, k: &Q) -> Option<V>
| ^
...
473 | Q: Hash + Eq,
| ^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations
= note: `#[warn(clippy::multiple_bound_locations)]` on by default
I expected to see this happen: No lint fired here, as long as ?Sized
cannot live in a where
-clause.
Version
rustc 1.79.0-nightly (4fd4797c2 2024-04-03)
binary: rustc
commit-hash: 4fd4797c2654977f545c9a91e2aa4e6cdbb38919
commit-date: 2024-04-03
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2
Additional Labels
No response
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have