@@ -16,7 +16,6 @@ use codemap::{Span, respan};
16
16
use ext:: base:: * ;
17
17
use ext:: base;
18
18
use ext:: build:: AstBuilder ;
19
- use fold:: Folder ;
20
19
use fmt_macros as parse;
21
20
use parse:: token:: special_idents;
22
21
use parse:: token;
@@ -635,6 +634,7 @@ pub fn ensure_not_fmt_string_literal<'cx>(cx: &'cx mut ExtCtxt,
635
634
sp : Span ,
636
635
tts : & [ ast:: TokenTree ] )
637
636
-> Box < base:: MacResult +' cx > {
637
+ use fold:: Folder ;
638
638
let takes_two_args = |cx : & ExtCtxt , rest| {
639
639
cx. span_err ( sp, & format ! ( "`ensure_not_fmt_string_literal!` \
640
640
takes 2 arguments, {}", rest) ) ;
@@ -643,9 +643,8 @@ pub fn ensure_not_fmt_string_literal<'cx>(cx: &'cx mut ExtCtxt,
643
643
let mut p = cx. new_parser_from_tts ( tts) ;
644
644
if p. token == token:: Eof { return takes_two_args ( cx, "given 0" ) ; }
645
645
let arg1 = cx. expander ( ) . fold_expr ( p. parse_expr ( ) ) ;
646
- if p. token != token:: Comma { return takes_two_args ( cx, "comma-separated" ) ; }
647
- p. bump ( ) ;
648
646
if p. token == token:: Eof { return takes_two_args ( cx, "given 1" ) ; }
647
+ if !p. eat ( & token:: Comma ) { return takes_two_args ( cx, "comma-separated" ) ; }
649
648
let arg2 = cx. expander ( ) . fold_expr ( p. parse_expr ( ) ) ;
650
649
if p. token != token:: Eof {
651
650
takes_two_args ( cx, "given too many" ) ;
0 commit comments