From 6dc763eed59295d0907a2780d66d4adf6f41a644 Mon Sep 17 00:00:00 2001 From: Aleksi Juvani Date: Sat, 7 Sep 2019 19:04:59 +0300 Subject: [PATCH] Fix nits --- src/librustc_target/spec/apple_base.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/librustc_target/spec/apple_base.rs b/src/librustc_target/spec/apple_base.rs index aa5080aaaf6e..297e64d4aeba 100644 --- a/src/librustc_target/spec/apple_base.rs +++ b/src/librustc_target/spec/apple_base.rs @@ -54,24 +54,24 @@ pub fn macos_llvm_target(arch: &str) -> String { pub fn sysroot(sdk: &str) -> Result { let actual_sdk_path = sdk_path(sdk)?; - // Like Clang, allow the SDKROOT environment variable used by Xcode to define the sysroot + // Like Clang, allow the `SDKROOT` environment variable used by Xcode to define the sysroot. if let Some(sdk_root) = env::var("SDKROOT").ok() { let sdk_root_p = Path::new(&sdk_root); - // Ignore SDKROOT if it's not a valid path + // Ignore `SDKROOT` if it's not a valid path. if !sdk_root_p.is_absolute() || sdk_root_p == Path::new("/") || !sdk_root_p.exists() { return Ok(actual_sdk_path); } - // Ignore SDKROOT if it's clearly set for the wrong platform, which may occur when we're - // compiling a custom build script while targeting iOS for example - match sdk { + // Ignore `SDKROOT` if it's clearly set for the wrong platform, which may occur when we're + // compiling a custom build script while targeting iOS for example. + return Ok(match sdk { "iphoneos" if sdk_root.contains("iPhoneSimulator.platform") - || sdk_root.contains("MacOSX.platform") => return Ok(actual_sdk_path), + || sdk_root.contains("MacOSX.platform") => actual_sdk_path, "iphonesimulator" if sdk_root.contains("iPhoneOS.platform") - || sdk_root.contains("MacOSX.platform") => return Ok(actual_sdk_path), + || sdk_root.contains("MacOSX.platform") => actual_sdk_path, "macosx" | "macosx10.15" if sdk_root.contains("iPhoneOS.platform") - || sdk_root.contains("iPhoneSimulator.platform") => return Ok(actual_sdk_path), - _ => return Ok(sdk_root), - } + || sdk_root.contains("iPhoneSimulator.platform") => actual_sdk_path, + _ => sdk_root, + }) } Ok(actual_sdk_path) }