Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive from type_repetition_in_bounds #5839

Closed
eopb opened this issue Jul 24, 2020 · 2 comments
Closed

False positive from type_repetition_in_bounds #5839

eopb opened this issue Jul 24, 2020 · 2 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@eopb
Copy link
Contributor

eopb commented Jul 24, 2020

I tried this code:

use std::collections::HashMap;

trait Example {}

struct Map<K, V>(HashMap<K, V>);

impl<K, V> Map<K, V>
where
    HashMap<K, V>: Clone,
    HashMap<String, V>: Example,
{
}

I get the warning

warning: this type has already been used as a bound predicate
  --> src/main.rs:14:5
   |
14 |     HashMap<String, V>: Example,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-W clippy::type-repetition-in-bounds` implied by `-W clippy::pedantic`
   = help: consider combining the bounds: `HashMap<String, V>: Clone + Example`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

HashMap<K, V> and HashMap<String, V> are different types so this lint should not show.

Meta

  • cargo clippy -V: clippy 0.0.212 (346aec9 2020-07-11)
  • rustc -Vv:
rustc 1.46.0-nightly (346aec9b0 2020-07-11)
binary: rustc
commit-hash: 346aec9b02f3c74f3fce97fd6bda24709d220e49
commit-date: 2020-07-11
host: x86_64-unknown-linux-gnu
release: 1.46.0-nightly
LLVM version: 10.0
@eopb eopb added the C-bug Category: Clippy is not doing the correct thing label Jul 24, 2020
@ThibsG
Copy link
Contributor

ThibsG commented Jul 25, 2020

Playgrounding this, I cannot reproduce it (Clippy's version 2020-07-24)

As #5761 has been merged recently, maybe it has already been fixed ?

@eopb
Copy link
Contributor Author

eopb commented Jul 25, 2020

Very possible thank you. I will reopen this issue if I run into this problem in future after updating with rustup when a version is avalable with all the components I use.

@eopb eopb closed this as completed Jul 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

No branches or pull requests

2 participants