Skip to content

Commit 1d30adb

Browse files
authored
Rollup merge of #110400 - matthiaskrgr:style_mix, r=fee1-dead
more clippy fixes: clippy::{iter_cloned_collect, unwarp_or_else_defau… …lt, option_map_or_none} r? `@Nilstrieb`
2 parents fba49a7 + 6ef8648 commit 1d30adb

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,7 @@ fn compare_number_of_generics<'tcx>(
13171317
impl_count,
13181318
kind,
13191319
pluralize!(impl_count),
1320-
suffix.unwrap_or_else(String::new),
1320+
suffix.unwrap_or_default(),
13211321
),
13221322
);
13231323
}

compiler/rustc_mir_transform/src/coverage/debug.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,8 @@ impl DebugCounters {
292292
}
293293

294294
pub fn some_block_label(&self, operand: ExpressionOperandId) -> Option<&String> {
295-
self.some_counters.as_ref().map_or(None, |counters| {
296-
counters
297-
.get(&operand)
298-
.map_or(None, |debug_counter| debug_counter.some_block_label.as_ref())
295+
self.some_counters.as_ref().and_then(|counters| {
296+
counters.get(&operand).and_then(|debug_counter| debug_counter.some_block_label.as_ref())
299297
})
300298
}
301299

compiler/rustc_transmute/src/layout/tree.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ pub(crate) mod rustc {
196196
fn from(err: LayoutError<'tcx>) -> Self {
197197
match err {
198198
LayoutError::Unknown(..) => Self::Unknown,
199-
err @ _ => unimplemented!("{:?}", err),
199+
err => unimplemented!("{:?}", err),
200200
}
201201
}
202202
}

src/librustdoc/clean/auto_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ where
141141
let f = auto_trait::AutoTraitFinder::new(tcx);
142142

143143
debug!("get_auto_trait_impls({:?})", ty);
144-
let auto_traits: Vec<_> = self.cx.auto_traits.iter().copied().collect();
144+
let auto_traits: Vec<_> = self.cx.auto_traits.to_vec();
145145
let mut auto_traits: Vec<Item> = auto_traits
146146
.into_iter()
147147
.filter_map(|trait_def_id| {

0 commit comments

Comments
 (0)