about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-04-15 19:17:08 +0200
committerMatthias Krüger <matthias.krueger@famsik.de>2023-04-16 12:45:51 +0200
commit6ef8648a4860e5d6108ebd21839c750de4f79dff (patch)
treef84fa3ede71f1033bbc1130173aa933cc9e91a6b /compiler
parente6e956dade79bdc084dfe3078abab24656a1b483 (diff)
downloadrust-6ef8648a4860e5d6108ebd21839c750de4f79dff.tar.gz
rust-6ef8648a4860e5d6108ebd21839c750de4f79dff.zip
more clippy fixes: clippy::{iter_cloned_collect, unwarp_or_else_default, option_map_or_none}
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_hir_analysis/src/check/compare_impl_item.rs2
-rw-r--r--compiler/rustc_mir_transform/src/coverage/debug.rs6
-rw-r--r--compiler/rustc_transmute/src/layout/tree.rs2
3 files changed, 4 insertions, 6 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
index 5d119a7737a..863a9977446 100644
--- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
+++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
@@ -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(),
                     ),
                 );
             }
diff --git a/compiler/rustc_mir_transform/src/coverage/debug.rs b/compiler/rustc_mir_transform/src/coverage/debug.rs
index 725883b83fa..e554c470646 100644
--- a/compiler/rustc_mir_transform/src/coverage/debug.rs
+++ b/compiler/rustc_mir_transform/src/coverage/debug.rs
@@ -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())
         })
     }
 
diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs
index 2a89494c80b..a6d88b1342a 100644
--- a/compiler/rustc_transmute/src/layout/tree.rs
+++ b/compiler/rustc_transmute/src/layout/tree.rs
@@ -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),
             }
         }
     }