Skip to content

Commit 3f16a86

Browse files
committed
dogfood
1 parent e272d9d commit 3f16a86

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

clippy_lints/src/could_be_assoc_type_bounds.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ declare_clippy_lint! {
3131
///
3232
/// fn example2<I: Iterator<Item = T>, T: Copy>() {}
3333
///
34-
/// fn example3<I, T>() -> impl IntoIterator<Item = impl Copy> {}
34+
/// fn example3(_: impl IntoIterator<Item = impl Copy>) {}
3535
/// ```
3636
///
3737
/// Use instead:
@@ -43,7 +43,7 @@ declare_clippy_lint! {
4343
///
4444
/// fn example2<I: Iterator<Item: Copy>>() {}
4545
///
46-
/// fn example3<I, T>() -> impl IntoIterator<Item: Copy> {}
46+
/// fn example3(_: impl IntoIterator<Item: Copy>) {}
4747
/// ```
4848
///
4949
/// [associated type bounds]: https://blog.rust-lang.org/2024/06/13/Rust-1.79.0.html#bounds-in-associated-type-position
@@ -115,12 +115,17 @@ impl ItemState {
115115
.params
116116
.iter()
117117
.enumerate()
118-
.filter(|(_, p)| matches!(p.kind, hir::GenericParamKind::Type { .. }))
119-
.map(|(param_index, &hir::GenericParam { def_id, .. })| TyParamState {
120-
def_id,
121-
param_index,
122-
use_count: 0,
123-
constrained_assoc_type: None,
118+
.filter_map(|(param_index, &hir::GenericParam { def_id, kind, .. })| {
119+
if let hir::GenericParamKind::Type { .. } = kind {
120+
Some(TyParamState {
121+
def_id,
122+
param_index,
123+
use_count: 0,
124+
constrained_assoc_type: None,
125+
})
126+
} else {
127+
None
128+
}
124129
})
125130
.collect(),
126131
}

0 commit comments

Comments
 (0)