about summary refs log tree commit diff
path: root/compiler/rustc_metadata/src
diff options
context:
space:
mode:
authorLingMan <LingMan@users.noreply.github.com>2021-01-11 20:45:33 +0100
committerLingMan <LingMan@users.noreply.github.com>2021-01-14 19:23:59 +0100
commita56bffb4f9d6f7791b2fa40412bd3e0549d76cc3 (patch)
tree23875d16475aea0b37a608f0ca704a3016c1f0e4 /compiler/rustc_metadata/src
parentd03fe84169d50a4b96cdef7b2f862217ab634055 (diff)
downloadrust-a56bffb4f9d6f7791b2fa40412bd3e0549d76cc3.tar.gz
rust-a56bffb4f9d6f7791b2fa40412bd3e0549d76cc3.zip
Use Option::map_or instead of `.map(..).unwrap_or(..)`
Diffstat (limited to 'compiler/rustc_metadata/src')
-rw-r--r--compiler/rustc_metadata/src/creader.rs2
-rw-r--r--compiler/rustc_metadata/src/native_libs.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs
index 019ca5174a2..a7bf79d7e67 100644
--- a/compiler/rustc_metadata/src/creader.rs
+++ b/compiler/rustc_metadata/src/creader.rs
@@ -326,7 +326,7 @@ impl<'a> CrateLoader<'a> {
         self.verify_no_symbol_conflicts(&crate_root)?;
 
         let private_dep =
-            self.sess.opts.externs.get(&name.as_str()).map(|e| e.is_private_dep).unwrap_or(false);
+            self.sess.opts.externs.get(&name.as_str()).map_or(false, |e| e.is_private_dep);
 
         // Claim this crate number and cache it
         let cnum = self.cstore.alloc_new_crate_num();
diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs
index 5b33678b25a..8d0994320e3 100644
--- a/compiler/rustc_metadata/src/native_libs.rs
+++ b/compiler/rustc_metadata/src/native_libs.rs
@@ -132,7 +132,7 @@ impl ItemLikeVisitor<'tcx> for Collector<'tcx> {
 
 impl Collector<'tcx> {
     fn register_native_lib(&mut self, span: Option<Span>, lib: NativeLib) {
-        if lib.name.as_ref().map(|&s| s == kw::Empty).unwrap_or(false) {
+        if lib.name.as_ref().map_or(false, |&s| s == kw::Empty) {
             match span {
                 Some(span) => {
                     struct_span_err!(