mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Fix #10504, don't lint on derived code
This commit is contained in:
parent
b033883e2b
commit
6ea7cd8ec7
3 changed files with 22 additions and 4 deletions
|
@ -260,6 +260,9 @@ impl TraitBounds {
|
|||
SpanlessTy { ty: p.bounded_ty, cx },
|
||||
p.bounds.iter().collect::<Vec<_>>()
|
||||
);
|
||||
if let TyKind::Path(qpath) = p.bounded_ty.kind;
|
||||
if format!("{}:", rustc_hir_pretty::qpath_to_string(&qpath))
|
||||
== format!("{}:", snippet(cx, p.bounded_ty.span, "_"));
|
||||
|
||||
then {
|
||||
let trait_bounds = v
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#![deny(clippy::type_repetition_in_bounds)]
|
||||
#![allow(clippy::extra_unused_type_parameters)]
|
||||
|
||||
use serde::Deserialize;
|
||||
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
|
||||
|
||||
pub fn foo<T>(_t: T)
|
||||
|
@ -70,6 +71,20 @@ mod issue4326 {
|
|||
}
|
||||
}
|
||||
|
||||
// Extern macros shouldn't lint, again (see #10504)
|
||||
mod issue10504 {
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt::Debug;
|
||||
use std::hash::Hash;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(bound(
|
||||
serialize = "T: Serialize + Hash + Eq",
|
||||
deserialize = "Box<T>: serde::de::DeserializeOwned + Hash + Eq"
|
||||
))]
|
||||
struct OpaqueParams<T: ?Sized + Debug>(std::marker::PhantomData<T>);
|
||||
}
|
||||
|
||||
// Issue #7360
|
||||
struct Foo<T, U>
|
||||
where
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: this type has already been used as a bound predicate
|
||||
--> $DIR/type_repetition_in_bounds.rs:9:5
|
||||
--> $DIR/type_repetition_in_bounds.rs:10:5
|
||||
|
|
||||
LL | T: Clone,
|
||||
| ^^^^^^^^
|
||||
|
@ -12,7 +12,7 @@ LL | #![deny(clippy::type_repetition_in_bounds)]
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this type has already been used as a bound predicate
|
||||
--> $DIR/type_repetition_in_bounds.rs:26:5
|
||||
--> $DIR/type_repetition_in_bounds.rs:27:5
|
||||
|
|
||||
LL | Self: Copy + Default + Ord,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -20,7 +20,7 @@ LL | Self: Copy + Default + Ord,
|
|||
= help: consider combining the bounds: `Self: Clone + Copy + Default + Ord`
|
||||
|
||||
error: this type has already been used as a bound predicate
|
||||
--> $DIR/type_repetition_in_bounds.rs:86:5
|
||||
--> $DIR/type_repetition_in_bounds.rs:101:5
|
||||
|
|
||||
LL | T: Clone,
|
||||
| ^^^^^^^^
|
||||
|
@ -28,7 +28,7 @@ LL | T: Clone,
|
|||
= help: consider combining the bounds: `T: ?Sized + Clone`
|
||||
|
||||
error: this type has already been used as a bound predicate
|
||||
--> $DIR/type_repetition_in_bounds.rs:91:5
|
||||
--> $DIR/type_repetition_in_bounds.rs:106:5
|
||||
|
|
||||
LL | T: ?Sized,
|
||||
| ^^^^^^^^^
|
||||
|
|
Loading…
Reference in a new issue