Skip to content

Commit 7d43997

Browse files
authored
Rollup merge of #69572 - matthiaskrgr:try_err_and_iter_on_ref, r=Centril
use .iter() instead of .into_iter() on references
2 parents b22631b + de7c40c commit 7d43997

File tree

20 files changed

+27
-31
lines changed

20 files changed

+27
-31
lines changed

src/librustc/ty/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,13 +2291,13 @@ impl<'tcx> TyCtxt<'tcx> {
22912291

22922292
#[inline]
22932293
pub fn intern_tup(self, ts: &[Ty<'tcx>]) -> Ty<'tcx> {
2294-
let kinds: Vec<_> = ts.into_iter().map(|&t| GenericArg::from(t)).collect();
2294+
let kinds: Vec<_> = ts.iter().map(|&t| GenericArg::from(t)).collect();
22952295
self.mk_ty(Tuple(self.intern_substs(&kinds)))
22962296
}
22972297

22982298
pub fn mk_tup<I: InternAs<[Ty<'tcx>], Ty<'tcx>>>(self, iter: I) -> I::Output {
22992299
iter.intern_with(|ts| {
2300-
let kinds: Vec<_> = ts.into_iter().map(|&t| GenericArg::from(t)).collect();
2300+
let kinds: Vec<_> = ts.iter().map(|&t| GenericArg::from(t)).collect();
23012301
self.mk_ty(Tuple(self.intern_substs(&kinds)))
23022302
})
23032303
}

src/librustc_builtin_macros/proc_macro_harness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl<'a> CollectProcMacros<'a> {
149149
.span_err(attr.span(), "attribute must be of form: `attributes(foo, bar)`");
150150
&[]
151151
})
152-
.into_iter()
152+
.iter()
153153
.filter_map(|attr| {
154154
let attr = match attr.meta_item() {
155155
Some(meta_item) => meta_item,

src/librustc_infer/infer/canonical/query_response.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ pub fn make_query_region_constraints<'tcx>(
630630
assert!(givens.is_empty());
631631

632632
let outlives: Vec<_> = constraints
633-
.into_iter()
633+
.iter()
634634
.map(|(k, _)| match *k {
635635
// Swap regions because we are going from sub (<=) to outlives
636636
// (>=).

src/librustc_infer/traits/on_unimplemented.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,8 @@ impl<'tcx> OnUnimplementedDirective {
237237
}
238238
}
239239

240-
let options: FxHashMap<Symbol, String> = options
241-
.into_iter()
242-
.filter_map(|(k, v)| v.as_ref().map(|v| (*k, v.to_owned())))
243-
.collect();
240+
let options: FxHashMap<Symbol, String> =
241+
options.iter().filter_map(|(k, v)| v.as_ref().map(|v| (*k, v.to_owned()))).collect();
244242
OnUnimplementedNote {
245243
label: label.map(|l| l.format(tcx, trait_ref, &options)),
246244
message: message.map(|m| m.format(tcx, trait_ref, &options)),

src/librustc_infer/traits/select.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2411,7 +2411,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
24112411

24122412
types
24132413
.skip_binder()
2414-
.into_iter()
2414+
.iter()
24152415
.flat_map(|ty| {
24162416
// binder moved -\
24172417
let ty: ty::Binder<Ty<'tcx>> = ty::Binder::bind(ty); // <----/

src/librustc_lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ impl EarlyLintPass for DeprecatedAttr {
739739
}
740740

741741
fn warn_if_doc(cx: &EarlyContext<'_>, node_span: Span, node_kind: &str, attrs: &[ast::Attribute]) {
742-
let mut attrs = attrs.into_iter().peekable();
742+
let mut attrs = attrs.iter().peekable();
743743

744744
// Accumulate a single span for sugared doc comments.
745745
let mut sugared_span: Option<Span> = None;

src/librustc_mir/borrow_check/diagnostics/move_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
519519
}
520520

521521
fn add_move_error_details(&self, err: &mut DiagnosticBuilder<'a>, binds_to: &[Local]) {
522-
for (j, local) in binds_to.into_iter().enumerate() {
522+
for (j, local) in binds_to.iter().enumerate() {
523523
let bind_to = &self.body.local_decls[*local];
524524
let binding_span = bind_to.source_info.span;
525525

src/librustc_mir/dataflow/generic/engine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ impl RustcMirAttrs {
419419
let mut ret = RustcMirAttrs::default();
420420

421421
let rustc_mir_attrs = attrs
422-
.into_iter()
422+
.iter()
423423
.filter(|attr| attr.check_name(sym::rustc_mir))
424424
.flat_map(|attr| attr.meta_item_list().into_iter().flat_map(|v| v.into_iter()));
425425

src/librustc_mir/dataflow/impls/borrows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> {
195195
.local_map
196196
.get(&place.local)
197197
.into_iter()
198-
.flat_map(|bs| bs.into_iter())
198+
.flat_map(|bs| bs.iter())
199199
.copied();
200200

201201
// If the borrowed place is a local with no projections, all other borrows of this

src/librustc_mir/interpret/operand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
509509
&self,
510510
ops: &[mir::Operand<'tcx>],
511511
) -> InterpResult<'tcx, Vec<OpTy<'tcx, M::PointerTag>>> {
512-
ops.into_iter().map(|op| self.eval_operand(op, None)).collect()
512+
ops.iter().map(|op| self.eval_operand(op, None)).collect()
513513
}
514514

515515
// Used when the miri-engine runs into a constant and for extracting information from constants

0 commit comments

Comments
 (0)