-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
#7360
Comments
Seems like you need to remove the
#![deny(clippy::type_repetition_in_bounds)]
use core::fmt;
pub struct Foo<T: ?Sized> {
_bar: T,
}
impl<T> fmt::Display for Foo<[T]>
where
[T]: Clone + fmt::Display,
{
fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
unreachable!()
}
} |
Sorry, I overlooked that. I thought that this lint only detected bounds of the same types and didn't expect that it warns such as I think suggesting |
This reasoning is wrong. First, Secondly, even if So yes, this is a bug in the lint, not the code. |
I've been having a similar issue with the following trait boundaries: A: Service<Request<Body>, Response = Response<BoxBody>> + Clone + Send + 'static,
B: Service<Request<Body>, Response = Response<BoxBody>> + Clone + Send + 'static,
A::Future: Send,
B::Future: Send,
A::Error: Into<BoxError> + Send,
B::Error: Into<BoxError> + Send,
Both After speaking with Yandros on the Rust Discord, they mentioned:
|
Permalinks:
|
Lint name:
type_repetition_in_bounds
I tried this code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=1107f6f365f12139ee07287fa5d80f88.
I expected to see this happen: No errors.
Instead, this happened:
Meta
cargo clippy -V
: clippy 0.1.54 (607d6b0 2021-06-15)rustc -Vv
:If I apply the suggestion by Clippy, I get another wrong error. code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=cd7648cbd5b5c16c3ba19593abef321f
errors:
The text was updated successfully, but these errors were encountered: