Skip to content

Commit 9dcf641

Browse files
committed
Fix build with Rust 1.16.0.
1 parent 552b139 commit 9dcf641

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2401,7 +2401,7 @@ fn spawn(cmd: &mut Command, program: &str) -> Result<(Child, JoinHandle<()>), Er
24012401
}
24022402

24032403
fn fail(s: &str) -> ! {
2404-
eprintln!("\n\nerror occurred: {}\n\n", s);
2404+
let _ = writeln!(io::stderr(), "\n\nerror occurred: {}\n\n", s);
24052405
std::process::exit(1);
24062406
}
24072407

src/windows_registry.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,18 +225,18 @@ mod impl_ {
225225
return Box::new(iter::empty());
226226
};
227227
Box::new(instances.filter_map(|instance| {
228-
let instance = instance.ok()?;
229-
let installation_name = instance.installation_name().ok()?;
230-
if installation_name.to_str()?.starts_with("VisualStudio/16.") {
231-
Some(PathBuf::from(instance.installation_path().ok()?))
228+
let instance = otry!(instance.ok());
229+
let installation_name = otry!(instance.installation_name().ok());
230+
if otry!(installation_name.to_str()).starts_with("VisualStudio/16.") {
231+
Some(PathBuf::from(otry!(instance.installation_path().ok())))
232232
} else {
233233
None
234234
}
235235
}))
236236
}
237237

238238
fn find_tool_in_vs16_path(tool: &str, target: &str) -> Option<Tool> {
239-
vs16_instances().find_map(|path| {
239+
vs16_instances().filter_map(|path| {
240240
let path = path.join(tool);
241241
if !path.is_file() {
242242
return None;
@@ -246,7 +246,7 @@ mod impl_ {
246246
tool.env.push(("Platform".into(), "X64".into()));
247247
}
248248
Some(tool)
249-
})
249+
}).next()
250250
}
251251

252252
fn find_msbuild_vs16(target: &str) -> Option<Tool> {
@@ -307,7 +307,7 @@ mod impl_ {
307307
.ok()
308308
.and_then(|key| key.query_str("15.0").ok())
309309
.map(|path| PathBuf::from(path).join(tool))
310-
.filter(|ref path| path.is_file());
310+
.and_then(|path| if path.is_file() { Some(path) } else { None });
311311
}
312312

313313
path.map(|path| {
@@ -681,7 +681,7 @@ mod impl_ {
681681
for subkey in key.iter().filter_map(|k| k.ok()) {
682682
let val = subkey
683683
.to_str()
684-
.and_then(|s| s.trim_start_matches("v").replace(".", "").parse().ok());
684+
.and_then(|s| s.trim_left_matches("v").replace(".", "").parse().ok());
685685
let val = match val {
686686
Some(s) => s,
687687
None => continue,

0 commit comments

Comments
 (0)