Fix clippy::into_iter_on_ref

This commit is contained in:
Alan Du 2019-06-04 02:28:50 -04:00
parent 619a615298
commit fb592d76aa
3 changed files with 3 additions and 3 deletions

View file

@ -57,7 +57,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
_ => return, _ => 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<Name> = struct_def let missed_fields: Vec<Name> = struct_def
.fields(db) .fields(db)
.iter() .iter()

View file

@ -1044,7 +1044,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
Expr::StructLit { path, fields, spread } => { Expr::StructLit { path, fields, spread } => {
let (ty, def_id) = self.resolve_variant(path.as_ref()); let (ty, def_id) = self.resolve_variant(path.as_ref());
let substs = ty.substs().unwrap_or_else(Substs::empty); 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 let field_ty = def_id
.and_then(|it| match it.field(self.db, &field.name) { .and_then(|it| match it.field(self.db, &field.name) {
Some(field) => Some(field), Some(field) => Some(field),

View file

@ -205,7 +205,7 @@ mod tests {
"The amount of fold kinds is different than the expected amount" "The amount of fold kinds is different than the expected amount"
); );
for ((fold, range), fold_kind) in 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.start(), range.start());
assert_eq!(fold.range.end(), range.end()); assert_eq!(fold.range.end(), range.end());