Skip to content

Commit 8479945

Browse files
committed
NFC don't convert types to identical types
1 parent a96d57b commit 8479945

File tree

24 files changed

+35
-50
lines changed

24 files changed

+35
-50
lines changed

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,9 +1260,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
12601260
);
12611261

12621262
// `a = lhs1; b = lhs2;`.
1263-
let stmts = self
1264-
.arena
1265-
.alloc_from_iter(std::iter::once(destructure_let).chain(assignments.into_iter()));
1263+
let stmts = self.arena.alloc_from_iter(std::iter::once(destructure_let).chain(assignments));
12661264

12671265
// Wrap everything in a block.
12681266
hir::ExprKind::Block(self.block_all(whole_span, stmts, None), None)

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ pub fn file_metadata<'ll>(cx: &CodegenCx<'ll, '_>, source_file: &SourceFile) ->
607607

608608
if let Ok(rel_path) = abs_path.strip_prefix(working_directory) {
609609
(
610-
working_directory.to_string_lossy().into(),
610+
working_directory.to_string_lossy(),
611611
rel_path.to_string_lossy().into_owned(),
612612
)
613613
} else {

compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ pub fn build_coroutine_variant_struct_type_di_node<'ll, 'tcx>(
396396
})
397397
.collect();
398398

399-
state_specific_fields.into_iter().chain(common_fields.into_iter()).collect()
399+
state_specific_fields.into_iter().chain(common_fields).collect()
400400
},
401401
|cx| build_generic_type_param_di_nodes(cx, coroutine_type_and_layout.ty),
402402
)

compiler/rustc_data_structures/src/sorted_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl<K: Ord, V> SortedMap<K, V> {
198198
if index == self.data.len() || elements.last().unwrap().0 < self.data[index].0 {
199199
// We can copy the whole range without having to mix with
200200
// existing elements.
201-
self.data.splice(index..index, elements.into_iter());
201+
self.data.splice(index..index, elements);
202202
return;
203203
}
204204

compiler/rustc_hir/src/hir.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,7 +1560,7 @@ impl Expr<'_> {
15601560
ExprKind::Call(..) => ExprPrecedence::Call,
15611561
ExprKind::MethodCall(..) => ExprPrecedence::MethodCall,
15621562
ExprKind::Tup(_) => ExprPrecedence::Tup,
1563-
ExprKind::Binary(op, ..) => ExprPrecedence::Binary(op.node.into()),
1563+
ExprKind::Binary(op, ..) => ExprPrecedence::Binary(op.node),
15641564
ExprKind::Unary(..) => ExprPrecedence::Unary,
15651565
ExprKind::Lit(_) => ExprPrecedence::Lit,
15661566
ExprKind::Type(..) | ExprKind::Cast(..) => ExprPrecedence::Cast,
@@ -1700,11 +1700,9 @@ impl Expr<'_> {
17001700
// them being used only for its side-effects.
17011701
base.can_have_side_effects()
17021702
}
1703-
ExprKind::Struct(_, fields, init) => fields
1704-
.iter()
1705-
.map(|field| field.expr)
1706-
.chain(init.into_iter())
1707-
.any(|e| e.can_have_side_effects()),
1703+
ExprKind::Struct(_, fields, init) => {
1704+
fields.iter().map(|field| field.expr).chain(init).any(|e| e.can_have_side_effects())
1705+
}
17081706

17091707
ExprKind::Array(args)
17101708
| ExprKind::Tup(args)

compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
350350
// Nested poly trait refs have the binders concatenated
351351
let mut full_binders =
352352
self.map.late_bound_vars.entry(*hir_id).or_default().clone();
353-
full_binders.extend(supertrait_bound_vars.into_iter());
353+
full_binders.extend(supertrait_bound_vars);
354354
break (full_binders, BinderScopeType::Concatenating);
355355
}
356356
}

compiler/rustc_hir_typeck/src/errors.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,13 +573,13 @@ impl rustc_errors::AddToDiagnostic for CastUnknownPointerSub {
573573
{
574574
match self {
575575
CastUnknownPointerSub::To(span) => {
576-
let msg = f(diag, crate::fluent_generated::hir_typeck_label_to.into());
576+
let msg = f(diag, crate::fluent_generated::hir_typeck_label_to);
577577
diag.span_label(span, msg);
578-
let msg = f(diag, crate::fluent_generated::hir_typeck_note.into());
578+
let msg = f(diag, crate::fluent_generated::hir_typeck_note);
579579
diag.note(msg);
580580
}
581581
CastUnknownPointerSub::From(span) => {
582-
let msg = f(diag, crate::fluent_generated::hir_typeck_label_from.into());
582+
let msg = f(diag, crate::fluent_generated::hir_typeck_label_from);
583583
diag.span_label(span, msg);
584584
}
585585
}

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,9 +1548,9 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
15481548
);
15491549

15501550
let candidate_obligations = impl_obligations
1551-
.chain(norm_obligations.into_iter())
1551+
.chain(norm_obligations)
15521552
.chain(ref_obligations.iter().cloned())
1553-
.chain(normalization_obligations.into_iter());
1553+
.chain(normalization_obligations);
15541554

15551555
// Evaluate those obligations to see if they might possibly hold.
15561556
for o in candidate_obligations {

compiler/rustc_infer/src/infer/outlives/verify.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
130130
// see the extensive comment in projection_must_outlive
131131
let recursive_bound = {
132132
let mut components = smallvec![];
133-
compute_alias_components_recursive(
134-
self.tcx,
135-
alias_ty_as_ty.into(),
136-
&mut components,
137-
visited,
138-
);
133+
compute_alias_components_recursive(self.tcx, alias_ty_as_ty, &mut components, visited);
139134
self.bound_from_components(&components, visited)
140135
};
141136

compiler/rustc_infer/src/infer/relate/combine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
552552
}
553553

554554
pub fn register_obligations(&mut self, obligations: PredicateObligations<'tcx>) {
555-
self.obligations.extend(obligations.into_iter());
555+
self.obligations.extend(obligations);
556556
}
557557

558558
pub fn register_predicates(&mut self, obligations: impl IntoIterator<Item: ToPredicate<'tcx>>) {

0 commit comments

Comments
 (0)