don't use Result::ok just to be able to use unwrap/unwrap_or

This commit is contained in:
Oliver Schneider
2015-03-20 08:19:13 +01:00
parent 0084f92302
commit b4a1e59146
21 changed files with 62 additions and 53 deletions

View File

@@ -623,7 +623,7 @@ impl<'a> StringReader<'a> {
// find the integer representing the name
self.scan_digits(base);
let encoded_name : u32 = self.with_str_from(start_bpos, |s| {
num::from_str_radix(s, 10).ok().unwrap_or_else(|| {
num::from_str_radix(s, 10).unwrap_or_else(|_| {
panic!("expected digits representing a name, got {:?}, {}, range [{:?},{:?}]",
s, whence, start_bpos, self.last_pos);
})
@@ -641,7 +641,7 @@ impl<'a> StringReader<'a> {
let start_bpos = self.last_pos;
self.scan_digits(base);
let encoded_ctxt : ast::SyntaxContext = self.with_str_from(start_bpos, |s| {
num::from_str_radix(s, 10).ok().unwrap_or_else(|| {
num::from_str_radix(s, 10).unwrap_or_else(|_| {
panic!("expected digits representing a ctxt, got {:?}, {}", s, whence);
})
});