rustdoc: clippy::complexity fixes
clippy::map_flatten clippy::clone_on_copy clippy::useless_conversion clippy::needless_arbitrary_self_type
This commit is contained in:
parent
4e8fb743cc
commit
f1a399abaa
7 changed files with 7 additions and 13 deletions
|
@ -1533,9 +1533,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
|
||||||
for pb in obj.projection_bounds() {
|
for pb in obj.projection_bounds() {
|
||||||
bindings.push(TypeBinding {
|
bindings.push(TypeBinding {
|
||||||
name: cx.tcx.associated_item(pb.item_def_id()).name,
|
name: cx.tcx.associated_item(pb.item_def_id()).name,
|
||||||
kind: TypeBindingKind::Equality {
|
kind: TypeBindingKind::Equality { term: pb.skip_binder().term.clean(cx) },
|
||||||
term: pb.skip_binder().term.clean(cx).into(),
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1036,8 +1036,7 @@ impl Attributes {
|
||||||
// Additional documentation should be shown before the original documentation
|
// Additional documentation should be shown before the original documentation
|
||||||
let other_attrs = additional_attrs
|
let other_attrs = additional_attrs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(attrs, id)| attrs.iter().map(move |attr| (attr, Some(id))))
|
.flat_map(|(attrs, id)| attrs.iter().map(move |attr| (attr, Some(id))))
|
||||||
.flatten()
|
|
||||||
.chain(attrs.iter().map(|attr| (attr, None)))
|
.chain(attrs.iter().map(|attr| (attr, None)))
|
||||||
.filter_map(clean_attr)
|
.filter_map(clean_attr)
|
||||||
.collect();
|
.collect();
|
||||||
|
|
|
@ -439,13 +439,12 @@ impl Options {
|
||||||
matches
|
matches
|
||||||
.opt_str("default-theme")
|
.opt_str("default-theme")
|
||||||
.iter()
|
.iter()
|
||||||
.map(|theme| {
|
.flat_map(|theme| {
|
||||||
vec![
|
vec![
|
||||||
("use-system-theme".to_string(), "false".to_string()),
|
("use-system-theme".to_string(), "false".to_string()),
|
||||||
("theme".to_string(), theme.to_string()),
|
("theme".to_string(), theme.to_string()),
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
.flatten()
|
|
||||||
.collect(),
|
.collect(),
|
||||||
matches
|
matches
|
||||||
.opt_strs("default-setting")
|
.opt_strs("default-setting")
|
||||||
|
|
|
@ -76,7 +76,7 @@ impl core::fmt::Write for Buffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn write_fmt(self: &mut Self, args: fmt::Arguments<'_>) -> fmt::Result {
|
fn write_fmt(&mut self, args: fmt::Arguments<'_>) -> fmt::Result {
|
||||||
self.buffer.write_fmt(args)
|
self.buffer.write_fmt(args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,8 +274,7 @@ impl Decorations {
|
||||||
let (mut starts, mut ends): (Vec<_>, Vec<_>) = info
|
let (mut starts, mut ends): (Vec<_>, Vec<_>) = info
|
||||||
.0
|
.0
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(kind, ranges)| ranges.into_iter().map(move |(lo, hi)| ((lo, kind), hi)))
|
.flat_map(|(kind, ranges)| ranges.into_iter().map(move |(lo, hi)| ((lo, kind), hi)))
|
||||||
.flatten()
|
|
||||||
.unzip();
|
.unzip();
|
||||||
|
|
||||||
// Sort the sequences in document order.
|
// Sort the sequences in document order.
|
||||||
|
|
|
@ -81,7 +81,7 @@ crate fn build_index<'tcx>(krate: &clean::Crate, cache: &mut Cache, tcx: TyCtxt<
|
||||||
lastpathid += 1;
|
lastpathid += 1;
|
||||||
|
|
||||||
if let Some(&(ref fqp, short)) = paths.get(&defid) {
|
if let Some(&(ref fqp, short)) = paths.get(&defid) {
|
||||||
crate_paths.push((short, fqp.last().unwrap().clone()));
|
crate_paths.push((short, *fqp.last().unwrap()));
|
||||||
Some(pathid)
|
Some(pathid)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
|
@ -247,8 +247,7 @@ crate fn run(
|
||||||
let target_crates = options
|
let target_crates = options
|
||||||
.target_crates
|
.target_crates
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|target| all_crates.iter().filter(move |(_, name)| name.as_str() == target))
|
.flat_map(|target| all_crates.iter().filter(move |(_, name)| name.as_str() == target))
|
||||||
.flatten()
|
|
||||||
.map(|(crate_num, _)| **crate_num)
|
.map(|(crate_num, _)| **crate_num)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue