1
Fork 0

Cut out a bunch of Result and panictry! boilerplate from libsyntax.

[breaking-change] if you use any of the changed functions, you'll need to remove a try! or panictry!
This commit is contained in:
Nick Cameron 2015-12-31 12:11:53 +13:00
parent efb5a9a9f0
commit 9023c659af
12 changed files with 318 additions and 313 deletions

View file

@ -113,7 +113,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
p.token != token::ModSep {
if !outputs.is_empty() {
panictry!(p.eat(&token::Comma));
p.eat(&token::Comma);
}
let (constraint, _str_style) = panictry!(p.parse_str());
@ -159,7 +159,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
p.token != token::ModSep {
if !inputs.is_empty() {
panictry!(p.eat(&token::Comma));
p.eat(&token::Comma);
}
let (constraint, _str_style) = panictry!(p.parse_str());
@ -183,7 +183,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
p.token != token::ModSep {
if !clobs.is_empty() {
panictry!(p.eat(&token::Comma));
p.eat(&token::Comma);
}
let (s, _str_style) = panictry!(p.parse_str());
@ -210,7 +210,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
}
if p.token == token::Comma {
panictry!(p.eat(&token::Comma));
p.eat(&token::Comma);
}
}
StateNone => ()
@ -222,12 +222,12 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
match (&p.token, state.next(), state.next().next()) {
(&token::Colon, StateNone, _) |
(&token::ModSep, _, StateNone) => {
panictry!(p.bump());
p.bump();
break 'statement;
}
(&token::Colon, st, _) |
(&token::ModSep, _, st) => {
panictry!(p.bump());
p.bump();
state = st;
}
(&token::Eof, _, _) => break 'statement,