Skip to content

Commit d1c00a3

Browse files
committed
dogfood
1 parent 7a7cc2f commit d1c00a3

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

clippy_lints/src/manual_assoc_type_bounds.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct TyParamState {
5454
/// fn f<T: Iterator<Item = P>, P: Copy>() -> P {}
5555
/// ^ ^ ^
5656
///
57-
/// After having visited everything in the item, the use_count of the generic parameter `P`
57+
/// After having visited everything in the item, the `use_count` of the generic parameter `P`
5858
/// is 3.
5959
/// We then check uses of `P` in the where clause and count 2 valid uses. `3 - 2 != 0` so at
6060
/// this point we see that we shouldn't lint.
@@ -186,7 +186,7 @@ impl ItemState {
186186
///
187187
/// - `U: Trait` if exactly one `T: Trait<Assoc = U>` bound exists in `trait_bounds` (i.e.,
188188
/// exactly one trait bound that has `U` as its associated type and is not used anywhere else,
189-
/// ensured by use_count == 0). Add `Emission::TyParamBound(U: Trait)` to `T: Trait<Assoc =
189+
/// ensured by `use_count` == 0). Add `Emission::TyParamBound(U: Trait)` to `T: Trait<Assoc =
190190
/// U>`s [`TraitBound::emissions`].
191191
///
192192
/// Note that synthetic/anonymous generic parameters introduced by `impl Trait` (e.g. `T:
@@ -277,7 +277,7 @@ impl ItemState {
277277
// TODO: REALLY dont use + iterate a hashmap here and isntead just sort?
278278
let grouped_emissions = emissions
279279
.iter()
280-
.into_group_map_by(|e| e.assoc_ty(trait_path_segment, &self));
280+
.into_group_map_by(|e| e.assoc_ty(trait_path_segment, self));
281281

282282
if let Some(args) = trait_path_segment.args
283283
&& let Some(args_span) = args.span()
@@ -350,7 +350,7 @@ impl ItemState {
350350
new_bounds += assoc.as_str();
351351
new_bounds += ": ";
352352

353-
Emission::append_bounds(&emissions, cx, &mut new_bounds, false);
353+
Emission::append_bounds(emissions, cx, &mut new_bounds, false);
354354
}
355355

356356
new_bounds += ">";
@@ -412,24 +412,12 @@ impl_lint_pass!(ManualAssocTypeBounds => [MANUAL_ASSOC_TYPE_BOUNDS]);
412412
#[derive(Debug)]
413413
enum Emission {
414414
ProjectionBound {
415-
// /// fn f<T>() where T: Iterator, <T as Iterator>::Item: Copy + Sized, {}
416-
// /// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
417-
// predicate_span: Span,
418415
predicate_index: usize,
419-
/// fn f<T>() where T: Iterator, <T as Iterator>::Item: Copy + Sized, {}
420-
/// ^^^^^^^^^^^^
421416
bounds_span: Span,
422-
/// fn f<T>() where T: Iterator, <T as Iterator>::Item: Copy + Sized, {}
423-
/// ^^^^
424417
assoc_type: Ident,
425418
},
426419
TyParamBound {
427-
/// fn f<T, P>() where T: Iterator<Item = P>, P: Copy + Sized, {}
428-
/// ^^^^^^^^^^^^^^^
429-
// predicate_span: Span,
430420
predicate_index: usize,
431-
/// fn f<T, P>() where T: Iterator<Item = P>, P: Copy + Sized, {}
432-
/// ^^^^^^^^^^^^
433421
bounds_span: Span,
434422
/// Index into `ItemState::ty_params`
435423
ty_param_index: usize,

clippy_utils/src/ty.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ pub fn implements_trait_with_env_from_iter<'tcx>(
251251
ty: Ty<'tcx>,
252252
trait_id: DefId,
253253
callee_id: Option<DefId>,
254-
args: impl IntoIterator<Item = impl Into<Option<GenericArg<'tcx>>>>,
254+
args: impl IntoIterator<Item: Into<Option<GenericArg<'tcx>>>>,
255255
) -> bool {
256256
// Clippy shouldn't have infer types
257257
assert!(!ty.has_infer());
@@ -1073,7 +1073,7 @@ pub fn make_projection<'tcx>(
10731073
tcx: TyCtxt<'tcx>,
10741074
container_id: DefId,
10751075
assoc_ty: Symbol,
1076-
args: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>,
1076+
args: impl IntoIterator<Item: Into<GenericArg<'tcx>>>,
10771077
) -> Option<AliasTy<'tcx>> {
10781078
fn helper<'tcx>(
10791079
tcx: TyCtxt<'tcx>,
@@ -1114,7 +1114,7 @@ pub fn make_normalized_projection<'tcx>(
11141114
param_env: ParamEnv<'tcx>,
11151115
container_id: DefId,
11161116
assoc_ty: Symbol,
1117-
args: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>,
1117+
args: impl IntoIterator<Item: Into<GenericArg<'tcx>>>,
11181118
) -> Option<Ty<'tcx>> {
11191119
fn helper<'tcx>(tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, ty: AliasTy<'tcx>) -> Option<Ty<'tcx>> {
11201120
#[cfg(debug_assertions)]
@@ -1241,7 +1241,7 @@ pub fn make_normalized_projection_with_regions<'tcx>(
12411241
param_env: ParamEnv<'tcx>,
12421242
container_id: DefId,
12431243
assoc_ty: Symbol,
1244-
args: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>,
1244+
args: impl IntoIterator<Item: Into<GenericArg<'tcx>>>,
12451245
) -> Option<Ty<'tcx>> {
12461246
fn helper<'tcx>(tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, ty: AliasTy<'tcx>) -> Option<Ty<'tcx>> {
12471247
#[cfg(debug_assertions)]

0 commit comments

Comments
 (0)