diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2015-12-31 12:11:53 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2015-12-31 14:29:02 +1300 |
| commit | 9023c659af8a43dd5e284d7b311e5f19721c9bd8 (patch) | |
| tree | 2f119e231c3f141514dcf59cf3c5d3b91d952a33 /src/libsyntax_ext | |
| parent | efb5a9a9f03016b8d3d3c13f940bbbfeac2cdfa6 (diff) | |
| download | rust-9023c659af8a43dd5e284d7b311e5f19721c9bd8.tar.gz rust-9023c659af8a43dd5e284d7b311e5f19721c9bd8.zip | |
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!
Diffstat (limited to 'src/libsyntax_ext')
| -rw-r--r-- | src/libsyntax_ext/asm.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax_ext/cfg.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/format.rs | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/libsyntax_ext/asm.rs b/src/libsyntax_ext/asm.rs index e5c6a17c78b..2f50f610d2b 100644 --- a/src/libsyntax_ext/asm.rs +++ b/src/libsyntax_ext/asm.rs @@ -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, diff --git a/src/libsyntax_ext/cfg.rs b/src/libsyntax_ext/cfg.rs index ff0f139d825..bae0462b8d3 100644 --- a/src/libsyntax_ext/cfg.rs +++ b/src/libsyntax_ext/cfg.rs @@ -28,7 +28,7 @@ pub fn expand_cfg<'cx>(cx: &mut ExtCtxt, let mut p = cx.new_parser_from_tts(tts); let cfg = panictry!(p.parse_meta_item()); - if !panictry!(p.eat(&token::Eof)){ + if !p.eat(&token::Eof) { cx.span_err(sp, "expected 1 cfg-pattern"); return DummyResult::expr(sp); } diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index 78e7f7462f3..1fb2b55215d 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -98,7 +98,7 @@ fn parse_args(ecx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) let fmtstr = panictry!(p.parse_expr()); let mut named = false; while p.token != token::Eof { - if !panictry!(p.eat(&token::Comma)) { + if !p.eat(&token::Comma) { ecx.span_err(sp, "expected token: `,`"); return None; } @@ -107,7 +107,7 @@ fn parse_args(ecx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) named = true; let ident = match p.token { token::Ident(i, _) => { - panictry!(p.bump()); + p.bump(); i } _ if named => { |
