From e3a8ea4e18a50da60036d2731768a9cb78c90f5a Mon Sep 17 00:00:00 2001 From: varkor Date: Tue, 8 Oct 2019 01:14:42 +0100 Subject: Use `to_option` in various places --- src/librustc_codegen_ssa/back/rpath.rs | 6 +----- src/librustc_codegen_ssa/back/symbol_export.rs | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) (limited to 'src/librustc_codegen_ssa/back') diff --git a/src/librustc_codegen_ssa/back/rpath.rs b/src/librustc_codegen_ssa/back/rpath.rs index e27cb6d8dda..b932a202093 100644 --- a/src/librustc_codegen_ssa/back/rpath.rs +++ b/src/librustc_codegen_ssa/back/rpath.rs @@ -119,11 +119,7 @@ fn path_relative_from(path: &Path, base: &Path) -> Option { use std::path::Component; if path.is_absolute() != base.is_absolute() { - if path.is_absolute() { - Some(PathBuf::from(path)) - } else { - None - } + path.is_absolute().to_option(PathBuf::from(path)) } else { let mut ita = path.components(); let mut itb = base.components(); diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index f8b3e0ffe5c..00519814071 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -85,11 +85,7 @@ fn reachable_non_generics_provider( match tcx.hir().get(hir_id) { Node::ForeignItem(..) => { let def_id = tcx.hir().local_def_id(hir_id); - if tcx.is_statically_included_foreign_item(def_id) { - Some(def_id) - } else { - None - } + tcx.is_statically_included_foreign_item(def_id).to_option(def_id) } // Only consider nodes that actually have exported symbols. -- cgit 1.4.1-3-g733a5