Skip to content

Commit

Permalink
avoid keyword conflict with try!; mute try! deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sielicki committed Apr 29, 2021
1 parent 5c385a9 commit faf8361
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ struct Version {
}

impl Version {
#[allow(deprecated)] // necessary for 1.10.0 compatibility with `r#try!`
fn parse(mut s: &str) -> Result<Version, String> {
if !s.starts_with("rustc ") {
return Err(format!("unrecognized version string: {}", s));
Expand All @@ -135,7 +136,7 @@ impl Version {
}
num.push(c);
}
let major = try!(num.parse::<u32>().map_err(|e| e.to_string()));
let major = r#try!(num.parse::<u32>().map_err(|e| e.to_string()));

num.clear();
for c in parts[1].chars() {
Expand All @@ -144,7 +145,7 @@ impl Version {
}
num.push(c);
}
let minor = try!(num.parse::<u32>().map_err(|e| e.to_string()));
let minor = r#try!(num.parse::<u32>().map_err(|e| e.to_string()));

num.clear();
for c in parts[2].chars() {
Expand All @@ -153,7 +154,7 @@ impl Version {
}
num.push(c);
}
let patch = try!(num.parse::<u32>().map_err(|e| e.to_string()));
let patch = r#try!(num.parse::<u32>().map_err(|e| e.to_string()));

Ok(Version {
major: major,
Expand Down

0 comments on commit faf8361

Please sign in to comment.