1
Fork 0

fix clippy::iter_kv_map

This commit is contained in:
Matthias Krüger 2023-04-01 23:44:16 +02:00
parent 0196c2bd27
commit ac229c2819
7 changed files with 10 additions and 15 deletions

View file

@ -483,8 +483,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
[segment] if segment.args.is_none() => { [segment] if segment.args.is_none() => {
trait_bound_spans = vec![segment.ident.span]; trait_bound_spans = vec![segment.ident.span];
associated_types = associated_types associated_types = associated_types
.into_iter() .into_values()
.map(|(_, items)| (segment.ident.span, items)) .map(|items| (segment.ident.span, items))
.collect(); .collect();
} }
_ => {} _ => {}

View file

@ -978,7 +978,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
let (_, sig, reg) = ty::print::FmtPrinter::new(self.tcx, Namespace::TypeNS) let (_, sig, reg) = ty::print::FmtPrinter::new(self.tcx, Namespace::TypeNS)
.name_all_regions(sig) .name_all_regions(sig)
.unwrap(); .unwrap();
let lts: Vec<String> = reg.into_iter().map(|(_, kind)| kind.to_string()).collect(); let lts: Vec<String> = reg.into_values().map(|kind| kind.to_string()).collect();
(if lts.is_empty() { String::new() } else { format!("for<{}> ", lts.join(", ")) }, sig) (if lts.is_empty() { String::new() } else { format!("for<{}> ", lts.join(", ")) }, sig)
}; };

View file

@ -19,7 +19,7 @@ pub mod lib_features {
.stable .stable
.iter() .iter()
.map(|(f, (s, _))| (*f, Some(*s))) .map(|(f, (s, _))| (*f, Some(*s)))
.chain(self.unstable.iter().map(|(f, _)| (*f, None))) .chain(self.unstable.keys().map(|f| (*f, None)))
.collect(); .collect();
all_features.sort_unstable_by(|a, b| a.0.as_str().partial_cmp(b.0.as_str()).unwrap()); all_features.sort_unstable_by(|a, b| a.0.as_str().partial_cmp(b.0.as_str()).unwrap());
all_features all_features

View file

@ -89,10 +89,7 @@ impl<'tcx> Partitioner<'tcx> for DefaultPartitioning {
} }
PreInliningPartitioning { PreInliningPartitioning {
codegen_units: codegen_units codegen_units: codegen_units.into_values().map(|codegen_unit| codegen_unit).collect(),
.into_iter()
.map(|(_, codegen_unit)| codegen_unit)
.collect(),
roots, roots,
internalization_candidates, internalization_candidates,
} }

View file

@ -1669,8 +1669,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
) -> Option<Symbol> { ) -> Option<Symbol> {
let mut candidates = self let mut candidates = self
.extern_prelude .extern_prelude
.iter() .keys()
.map(|(ident, _)| ident.name) .map(|ident| ident.name)
.chain( .chain(
self.module_map self.module_map
.iter() .iter()
@ -2007,7 +2007,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
// 1) some consistent ordering for emitted diagnostics, and // 1) some consistent ordering for emitted diagnostics, and
// 2) `std` suggestions before `core` suggestions. // 2) `std` suggestions before `core` suggestions.
let mut extern_crate_names = let mut extern_crate_names =
self.extern_prelude.iter().map(|(ident, _)| ident.name).collect::<Vec<_>>(); self.extern_prelude.keys().map(|ident| ident.name).collect::<Vec<_>>();
extern_crate_names.sort_by(|a, b| b.as_str().partial_cmp(a.as_str()).unwrap()); extern_crate_names.sort_by(|a, b| b.as_str().partial_cmp(a.as_str()).unwrap());
for name in extern_crate_names.into_iter() { for name in extern_crate_names.into_iter() {

View file

@ -2421,8 +2421,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
.iter() .iter()
.rfind(|r| matches!(r.kind, ItemRibKind(_))) .rfind(|r| matches!(r.kind, ItemRibKind(_)))
.expect("associated item outside of an item"); .expect("associated item outside of an item");
seen_bindings seen_bindings.extend(parent_rib.bindings.keys().map(|ident| (*ident, ident.span)));
.extend(parent_rib.bindings.iter().map(|(ident, _)| (*ident, ident.span)));
}; };
add_bindings_for_ns(ValueNS); add_bindings_for_ns(ValueNS);
add_bindings_for_ns(TypeNS); add_bindings_for_ns(TypeNS);

View file

@ -909,8 +909,7 @@ pub(crate) fn collect_bound_vars<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
.or_else(|| bug!("Skipped bound var index: parameters={:?}", parameters)); .or_else(|| bug!("Skipped bound var index: parameters={:?}", parameters));
}); });
let binders = let binders = chalk_ir::VariableKinds::from_iter(interner, parameters.into_values());
chalk_ir::VariableKinds::from_iter(interner, parameters.into_iter().map(|(_, v)| v));
(new_ty, binders, named_parameters) (new_ty, binders, named_parameters)
} }