syntax: Remove usage of fmt!

This commit is contained in:
Alex Crichton 2013-09-27 21:01:58 -07:00
parent 7e709bfd0d
commit af3b132285
34 changed files with 342 additions and 342 deletions

View file

@ -362,8 +362,8 @@ impl Parser {
pub fn unexpected_last(&self, t: &token::Token) -> ! {
self.span_fatal(
*self.last_span,
fmt!(
"unexpected token: `%s`",
format!(
"unexpected token: `{}`",
self.token_to_str(t)
)
);
@ -371,8 +371,8 @@ impl Parser {
pub fn unexpected(&self) -> ! {
self.fatal(
fmt!(
"unexpected token: `%s`",
format!(
"unexpected token: `{}`",
self.this_token_to_str()
)
);
@ -385,8 +385,8 @@ impl Parser {
self.bump();
} else {
self.fatal(
fmt!(
"expected `%s` but found `%s`",
format!(
"expected `{}` but found `{}`",
self.token_to_str(t),
self.this_token_to_str()
)
@ -414,9 +414,9 @@ impl Parser {
let actual = self.this_token_to_str();
self.fatal(
if expected.len() != 1 {
fmt!("expected one of `%s` but found `%s`", expect, actual)
format!("expected one of `{}` but found `{}`", expect, actual)
} else {
fmt!("expected `%s` but found `%s`", expect, actual)
format!("expected `{}` but found `{}`", expect, actual)
}
)
}
@ -444,7 +444,7 @@ impl Parser {
// followed by some token from the set edible + inedible. Recover
// from anticipated input errors, discarding erroneous characters.
pub fn commit_expr(&self, e: @Expr, edible: &[token::Token], inedible: &[token::Token]) {
debug!("commit_expr %?", e);
debug2!("commit_expr {:?}", e);
match e.node {
ExprPath(*) => {
// might be unit-struct construction; check for recoverableinput error.
@ -464,7 +464,7 @@ impl Parser {
// followed by some token from the set edible + inedible. Check
// for recoverable input errors, discarding erroneous characters.
pub fn commit_stmt(&self, s: @Stmt, edible: &[token::Token], inedible: &[token::Token]) {
debug!("commit_stmt %?", s);
debug2!("commit_stmt {:?}", s);
let _s = s; // unused, but future checks might want to inspect `s`.
if self.last_token.map_default(false, |t|is_ident_or_path(*t)) {
let expected = vec::append(edible.to_owned(), inedible);
@ -490,8 +490,8 @@ impl Parser {
}
_ => {
self.fatal(
fmt!(
"expected ident, found `%s`",
format!(
"expected ident, found `{}`",
self.this_token_to_str()
)
);
@ -536,8 +536,8 @@ impl Parser {
pub fn expect_keyword(&self, kw: keywords::Keyword) {
if !self.eat_keyword(kw) {
self.fatal(
fmt!(
"expected `%s`, found `%s`",
format!(
"expected `{}`, found `{}`",
self.id_to_str(kw.to_ident()).to_str(),
self.this_token_to_str()
)
@ -549,14 +549,14 @@ impl Parser {
pub fn check_strict_keywords(&self) {
if token::is_strict_keyword(self.token) {
self.span_err(*self.last_span,
fmt!("found `%s` in ident position", self.this_token_to_str()));
format!("found `{}` in ident position", self.this_token_to_str()));
}
}
// signal an error if the current token is a reserved keyword
pub fn check_reserved_keywords(&self) {
if token::is_reserved_keyword(self.token) {
self.fatal(fmt!("`%s` is a reserved keyword", self.this_token_to_str()));
self.fatal(format!("`{}` is a reserved keyword", self.this_token_to_str()));
}
}
@ -571,7 +571,7 @@ impl Parser {
self.span.lo + BytePos(1u),
self.span.hi
),
_ => self.fatal(fmt!("expected `%s`, found `%s`",
_ => self.fatal(format!("expected `{}`, found `{}`",
self.token_to_str(&token::GT),
self.this_token_to_str()))
}
@ -938,13 +938,13 @@ impl Parser {
};
let hi = p.last_span.hi;
debug!("parse_trait_methods(): trait method signature ends in \
`%s`",
debug2!("parse_trait_methods(): trait method signature ends in \
`{}`",
self.this_token_to_str());
match *p.token {
token::SEMI => {
p.bump();
debug!("parse_trait_methods(): parsing required method");
debug2!("parse_trait_methods(): parsing required method");
// NB: at the moment, visibility annotations on required
// methods are ignored; this could change.
if vis != ast::inherited {
@ -963,7 +963,7 @@ impl Parser {
})
}
token::LBRACE => {
debug!("parse_trait_methods(): parsing provided method");
debug2!("parse_trait_methods(): parsing provided method");
let (inner_attrs, body) =
p.parse_inner_attrs_and_block();
let attrs = vec::append(attrs, inner_attrs);
@ -984,8 +984,8 @@ impl Parser {
_ => {
p.fatal(
fmt!(
"expected `;` or `{` but found `%s`",
format!(
"expected `;` or `\\{` but found `{}`",
self.this_token_to_str()
)
);
@ -1153,8 +1153,7 @@ impl Parser {
} = self.parse_path(LifetimeAndTypesAndBounds);
ty_path(path, bounds, ast::DUMMY_NODE_ID)
} else {
self.fatal(fmt!("expected type, found token %?",
*self.token));
self.fatal(format!("expected type, found token {:?}", *self.token));
};
let sp = mk_sp(lo, self.last_span.hi);
@ -1245,7 +1244,7 @@ impl Parser {
_ => 0
};
debug!("parser is_named_argument offset:%u", offset);
debug2!("parser is_named_argument offset:{}", offset);
if offset == 0 {
is_plain_ident_or_underscore(&*self.token)
@ -1261,7 +1260,7 @@ impl Parser {
pub fn parse_arg_general(&self, require_name: bool) -> arg {
let is_mutbl = self.eat_keyword(keywords::Mut);
let pat = if require_name || self.is_named_argument() {
debug!("parse_arg_general parse_pat (require_name:%?)",
debug2!("parse_arg_general parse_pat (require_name:{:?})",
require_name);
self.parse_arg_mode();
let pat = self.parse_pat();
@ -1273,7 +1272,7 @@ impl Parser {
self.expect(&token::COLON);
pat
} else {
debug!("parse_arg_general ident_to_pat");
debug2!("parse_arg_general ident_to_pat");
ast_util::ident_to_pat(ast::DUMMY_NODE_ID,
*self.last_span,
special_idents::invalid)
@ -1581,7 +1580,7 @@ impl Parser {
}
_ => {
self.fatal(fmt!("Expected a lifetime name"));
self.fatal(format!("Expected a lifetime name"));
}
}
}
@ -1614,7 +1613,7 @@ impl Parser {
token::GT => { return res; }
token::BINOP(token::SHR) => { return res; }
_ => {
self.fatal(fmt!("expected `,` or `>` after lifetime name, got: %?",
self.fatal(format!("expected `,` or `>` after lifetime name, got: {:?}",
*self.token));
}
}
@ -2067,8 +2066,8 @@ impl Parser {
token::RPAREN | token::RBRACE | token::RBRACKET
=> {
p.fatal(
fmt!(
"incorrect close delimiter: `%s`",
format!(
"incorrect close delimiter: `{}`",
p.this_token_to_str()
)
);
@ -2561,10 +2560,10 @@ impl Parser {
// There may be other types of expressions that can
// represent the callee in `for` and `do` expressions
// but they aren't represented by tests
debug!("sugary call on %?", e.node);
debug2!("sugary call on {:?}", e.node);
self.span_fatal(
e.span,
fmt!("`%s` must be followed by a block call", keyword));
format!("`{}` must be followed by a block call", keyword));
}
}
}
@ -2759,8 +2758,8 @@ impl Parser {
self.bump();
if *self.token != token::RBRACE {
self.fatal(
fmt!(
"expected `}`, found `%s`",
format!(
"expected `\\}`, found `{}`",
self.this_token_to_str()
)
);
@ -3543,8 +3542,8 @@ impl Parser {
fn expect_self_ident(&self) {
if !self.is_self_ident() {
self.fatal(
fmt!(
"expected `self` but found `%s`",
format!(
"expected `self` but found `{}`",
self.this_token_to_str()
)
);
@ -3682,8 +3681,8 @@ impl Parser {
}
_ => {
self.fatal(
fmt!(
"expected `,` or `)`, found `%s`",
format!(
"expected `,` or `)`, found `{}`",
self.this_token_to_str()
)
);
@ -3920,7 +3919,7 @@ impl Parser {
}
}
if fields.len() == 0 {
self.fatal(fmt!("Unit-like struct definition should be written as `struct %s;`",
self.fatal(format!("Unit-like struct definition should be written as `struct {};`",
get_ident_interner().get(class_name.name)));
}
self.bump();
@ -3949,9 +3948,9 @@ impl Parser {
fields = ~[];
} else {
self.fatal(
fmt!(
"expected `{`, `(`, or `;` after struct name \
but found `%s`",
format!(
"expected `\\{`, `(`, or `;` after struct name \
but found `{}`",
self.this_token_to_str()
)
);
@ -3995,7 +3994,7 @@ impl Parser {
token::RBRACE => {}
_ => {
self.span_fatal(*self.span,
fmt!("expected `,`, or '}' but found `%s`",
format!("expected `,`, or '\\}' but found `{}`",
self.this_token_to_str()));
}
}
@ -4064,7 +4063,7 @@ impl Parser {
attrs = attrs_remaining + attrs;
first = false;
}
debug!("parse_mod_items: parse_item_or_view_item(attrs=%?)",
debug2!("parse_mod_items: parse_item_or_view_item(attrs={:?})",
attrs);
match self.parse_item_or_view_item(attrs,
true /* macros allowed */) {
@ -4075,7 +4074,7 @@ impl Parser {
the module");
}
_ => {
self.fatal(fmt!("expected item but found `%s`",
self.fatal(format!("expected item but found `{}`",
self.this_token_to_str()));
}
}
@ -4167,11 +4166,11 @@ impl Parser {
(true, false) => default_path,
(false, true) => secondary_path,
(false, false) => {
self.span_fatal(id_sp, fmt!("file not found for module `%s`", mod_name));
self.span_fatal(id_sp, format!("file not found for module `{}`", mod_name));
}
(true, true) => {
self.span_fatal(id_sp,
fmt!("file for module `%s` found at both %s and %s",
format!("file for module `{}` found at both {} and {}",
mod_name, default_path_str, secondary_path_str));
}
}
@ -4323,7 +4322,7 @@ impl Parser {
self.expect_keyword(keywords::Mod);
} else if *self.token != token::LBRACE {
self.span_fatal(*self.span,
fmt!("expected `{` or `mod` but found `%s`",
format!("expected `\\{` or `mod` but found `{}`",
self.this_token_to_str()));
}
@ -4340,8 +4339,8 @@ impl Parser {
_ => {
if must_be_named_mod {
self.span_fatal(*self.span,
fmt!("expected foreign module name but \
found `%s`",
format!("expected foreign module name but \
found `{}`",
self.this_token_to_str()));
}
@ -4566,7 +4565,7 @@ impl Parser {
if abis.contains(abi) {
self.span_err(
*self.span,
fmt!("ABI `%s` appears twice",
format!("ABI `{}` appears twice",
word));
} else {
abis.add(abi);
@ -4576,9 +4575,9 @@ impl Parser {
None => {
self.span_err(
*self.span,
fmt!("illegal ABI: \
expected one of [%s], \
found `%s`",
format!("illegal ABI: \
expected one of [{}], \
found `{}`",
abi::all_names().connect(", "),
word));
}
@ -4853,7 +4852,7 @@ impl Parser {
let first_ident = self.parse_ident();
let mut path = ~[first_ident];
debug!("parsed view_path: %s", self.id_to_str(first_ident));
debug2!("parsed view_path: {}", self.id_to_str(first_ident));
match *self.token {
token::EQ => {
// x = foo::bar
@ -5061,7 +5060,7 @@ impl Parser {
break;
}
iovi_foreign_item(_) => {
fail!();
fail2!();
}
}
attrs = self.parse_outer_attributes();
@ -5084,7 +5083,7 @@ impl Parser {
items.push(item)
}
iovi_foreign_item(_) => {
fail!();
fail2!();
}
}
}