From fb592d76aa24e8fe74694038c283f56ea83ab568 Mon Sep 17 00:00:00 2001 From: Alan Du Date: Tue, 4 Jun 2019 02:28:50 -0400 Subject: Fix clippy::into_iter_on_ref --- crates/ra_hir/src/expr/validation.rs | 2 +- crates/ra_hir/src/ty/infer.rs | 2 +- crates/ra_ide_api/src/folding_ranges.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs index 0248b087d..592f558f2 100644 --- a/crates/ra_hir/src/expr/validation.rs +++ b/crates/ra_hir/src/expr/validation.rs @@ -57,7 +57,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> { _ => return, }; - let lit_fields: FxHashSet<_> = fields.into_iter().map(|f| &f.name).collect(); + let lit_fields: FxHashSet<_> = fields.iter().map(|f| &f.name).collect(); let missed_fields: Vec = struct_def .fields(db) .iter() diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index 1723921e6..58cfcd8a2 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs @@ -1044,7 +1044,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { Expr::StructLit { path, fields, spread } => { let (ty, def_id) = self.resolve_variant(path.as_ref()); let substs = ty.substs().unwrap_or_else(Substs::empty); - for (field_idx, field) in fields.into_iter().enumerate() { + for (field_idx, field) in fields.iter().enumerate() { let field_ty = def_id .and_then(|it| match it.field(self.db, &field.name) { Some(field) => Some(field), diff --git a/crates/ra_ide_api/src/folding_ranges.rs b/crates/ra_ide_api/src/folding_ranges.rs index b50bbee38..4400ff232 100644 --- a/crates/ra_ide_api/src/folding_ranges.rs +++ b/crates/ra_ide_api/src/folding_ranges.rs @@ -205,7 +205,7 @@ mod tests { "The amount of fold kinds is different than the expected amount" ); for ((fold, range), fold_kind) in - folds.into_iter().zip(ranges.into_iter()).zip(fold_kinds.into_iter()) + folds.iter().zip(ranges.into_iter()).zip(fold_kinds.iter()) { assert_eq!(fold.range.start(), range.start()); assert_eq!(fold.range.end(), range.end()); -- cgit v1.2.3