Skip to content

Commit 22376be

Browse files
committed
syntax: format: remove unused method_statics field.
1 parent 0201334 commit 22376be

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

src/libsyntax/ext/format.rs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ struct Context<'a, 'b:'a> {
6363
all_pieces_simple: bool,
6464

6565
name_positions: HashMap<string::String, uint>,
66-
method_statics: Vec<P<ast::Item>>,
6766

6867
/// Updated as arguments are consumed or methods are entered
6968
nest_level: uint,
@@ -495,20 +494,12 @@ impl<'a, 'b> Context<'a, 'b> {
495494
/// Actually builds the expression which the iformat! block will be expanded
496495
/// to
497496
fn to_expr(mut self, invocation: Invocation) -> P<ast::Expr> {
498-
let mut lets = Vec::new();
499497
let mut locals = Vec::new();
500498
let mut names = Vec::from_fn(self.name_positions.len(), |_| None);
501499
let mut pats = Vec::new();
502500
let mut heads = Vec::new();
503501

504-
// First, declare all of our methods that are statics
505-
for method in self.method_statics.into_iter() {
506-
let decl = respan(self.fmtsp, ast::DeclItem(method));
507-
lets.push(P(respan(self.fmtsp,
508-
ast::StmtDecl(P(decl), ast::DUMMY_NODE_ID))));
509-
}
510-
511-
// Next, build up the static array which will become our precompiled
502+
// First, build up the static array which will become our precompiled
512503
// format "string"
513504
let static_str_name = self.ecx.ident_of("__STATIC_FMTSTR");
514505
let static_lifetime = self.ecx.lifetime(self.fmtsp, self.ecx.ident_of("'static").name);
@@ -517,10 +508,9 @@ impl<'a, 'b> Context<'a, 'b> {
517508
self.ecx.ty_ident(self.fmtsp, self.ecx.ident_of("str")),
518509
Some(static_lifetime),
519510
ast::MutImmutable);
520-
lets.push(Context::item_static_array(self.ecx,
521-
static_str_name,
522-
piece_ty,
523-
self.str_pieces));
511+
let mut lets = vec![
512+
Context::item_static_array(self.ecx, static_str_name, piece_ty, self.str_pieces)
513+
];
524514

525515
// Then, build up the static array which will store our precompiled
526516
// nonstandard placeholders, if there are any.
@@ -728,7 +718,6 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, sp: Span,
728718
pieces: Vec::new(),
729719
str_pieces: Vec::new(),
730720
all_pieces_simple: true,
731-
method_statics: Vec::new(),
732721
fmtsp: sp,
733722
};
734723
cx.fmtsp = efmt.span;

0 commit comments

Comments
 (0)