Dogfood 'str_split_once() with compiler/

This commit is contained in:
Eric Arellano 2020-12-07 11:59:24 -07:00
parent 0f6f2d681b
commit 12db2225b6
7 changed files with 83 additions and 89 deletions

View file

@ -15,6 +15,7 @@
#![feature(never_type)]
#![feature(associated_type_bounds)]
#![feature(exhaustive_patterns)]
#![feature(str_split_once)]
#[macro_use]
extern crate rustc_macros;

View file

@ -54,10 +54,7 @@ fn macos_deployment_target() -> (u32, u32) {
let deployment_target = env::var("MACOSX_DEPLOYMENT_TARGET").ok();
let version = deployment_target
.as_ref()
.and_then(|s| {
let mut i = s.splitn(2, '.');
i.next().and_then(|a| i.next().map(|b| (a, b)))
})
.and_then(|s| s.split_once('.'))
.and_then(|(a, b)| a.parse::<u32>().and_then(|a| b.parse::<u32>().map(|b| (a, b))).ok());
version.unwrap_or((10, 7))