Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace try! macro with '?' operator. #94

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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