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() => {
trait_bound_spans = vec![segment.ident.span];
associated_types = associated_types
.into_iter()
.map(|(_, items)| (segment.ident.span, items))
.into_values()
.map(|items| (segment.ident.span, items))
.collect();
}
_ => {}

View file

@ -978,7 +978,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
let (_, sig, reg) = ty::print::FmtPrinter::new(self.tcx, Namespace::TypeNS)
.name_all_regions(sig)
.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)
};

View file

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

View file

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

View file

@ -1669,8 +1669,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
) -> Option<Symbol> {
let mut candidates = self
.extern_prelude
.iter()
.map(|(ident, _)| ident.name)
.keys()
.map(|ident| ident.name)
.chain(
self.module_map
.iter()
@ -2007,7 +2007,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
// 1) some consistent ordering for emitted diagnostics, and
// 2) `std` suggestions before `core` suggestions.
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());
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()
.rfind(|r| matches!(r.kind, ItemRibKind(_)))
.expect("associated item outside of an item");
seen_bindings
.extend(parent_rib.bindings.iter().map(|(ident, _)| (*ident, ident.span)));
seen_bindings.extend(parent_rib.bindings.keys().map(|ident| (*ident, ident.span)));
};
add_bindings_for_ns(ValueNS);
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));
});
let binders =
chalk_ir::VariableKinds::from_iter(interner, parameters.into_iter().map(|(_, v)| v));
let binders = chalk_ir::VariableKinds::from_iter(interner, parameters.into_values());
(new_ty, binders, named_parameters)
}