Skip to content

Commit 1bfad5a

Browse files
committed
Remove try_opt macro
1 parent 4b481ad commit 1bfad5a

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/windows_msvc.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@ use winreg::enums::*;
44
use std::{env, fs};
55
use winreg;
66

7-
macro_rules! try_opt {
8-
($opt:expr) => {
9-
if let Some(o) = $opt {
10-
o
11-
} else {
12-
return None;
13-
}
14-
}
15-
}
16-
177
pub const SUPPORTED: bool = true;
188

199
#[derive(Clone, Copy, Eq, PartialEq)]
@@ -69,12 +59,12 @@ fn find_latest_windows_sdk_rc_exe(arch: Arch) -> Option<PathBuf> {
6959

7060
// Windows 10 with subdir support
7161
fn find_windows_10_kits_rc_exe(key: &str, arch: Arch) -> Option<PathBuf> {
72-
let root_dir = try_opt!(winreg::RegKey::predef(HKEY_LOCAL_MACHINE)
62+
let root_dir = (winreg::RegKey::predef(HKEY_LOCAL_MACHINE)
7363
.open_subkey_with_flags(r"SOFTWARE\Microsoft\Windows Kits\Installed Roots", KEY_QUERY_VALUE)
7464
.and_then(|reg_key| reg_key.get_value::<String, _>(key))
75-
.ok()) + "/bin";
65+
.ok())? + "/bin";
7666

77-
for entry in try_opt!(fs::read_dir(&root_dir).ok()).filter(|d| d.is_ok()).map(Result::unwrap) {
67+
for entry in fs::read_dir(&root_dir).ok()?.filter(|d| d.is_ok()).map(Result::unwrap) {
7868
let fname = entry.file_name().into_string();
7969
let ftype = entry.file_type();
8070
if fname.is_err() || ftype.is_err() || ftype.unwrap().is_file() {

0 commit comments

Comments
 (0)