Skip to content

Commit

Permalink
Rollup merge of rust-lang#110400 - matthiaskrgr:style_mix, r=fee1-dead
Browse files Browse the repository at this point in the history
more clippy fixes: clippy::{iter_cloned_collect, unwarp_or_else_defau…

…lt, option_map_or_none}

r? ``@Nilstrieb``
  • Loading branch information
fee1-dead authored Apr 16, 2023
2 parents 726b217 + 6ef8648 commit 5e2fcbc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ fn compare_number_of_generics<'tcx>(
impl_count,
kind,
pluralize!(impl_count),
suffix.unwrap_or_else(String::new),
suffix.unwrap_or_default(),
),
);
}
Expand Down
6 changes: 2 additions & 4 deletions compiler/rustc_mir_transform/src/coverage/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,8 @@ impl DebugCounters {
}

pub fn some_block_label(&self, operand: ExpressionOperandId) -> Option<&String> {
self.some_counters.as_ref().map_or(None, |counters| {
counters
.get(&operand)
.map_or(None, |debug_counter| debug_counter.some_block_label.as_ref())
self.some_counters.as_ref().and_then(|counters| {
counters.get(&operand).and_then(|debug_counter| debug_counter.some_block_label.as_ref())
})
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_transmute/src/layout/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ pub(crate) mod rustc {
fn from(err: LayoutError<'tcx>) -> Self {
match err {
LayoutError::Unknown(..) => Self::Unknown,
err @ _ => unimplemented!("{:?}", err),
err => unimplemented!("{:?}", err),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/clean/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ where
let f = auto_trait::AutoTraitFinder::new(tcx);

debug!("get_auto_trait_impls({:?})", ty);
let auto_traits: Vec<_> = self.cx.auto_traits.iter().copied().collect();
let auto_traits: Vec<_> = self.cx.auto_traits.to_vec();
let mut auto_traits: Vec<Item> = auto_traits
.into_iter()
.filter_map(|trait_def_id| {
Expand Down

0 comments on commit 5e2fcbc

Please sign in to comment.