syntax: remove unused 'mut' variables
This commit is contained in:
parent
7d317fe7e5
commit
fd97cac251
7 changed files with 29 additions and 27 deletions
|
@ -342,7 +342,7 @@ fn highlight_lines_internal(cm: @codemap::CodeMap,
|
||||||
while num > 0u { num /= 10u; digits += 1u; }
|
while num > 0u { num /= 10u; digits += 1u; }
|
||||||
|
|
||||||
// indent past |name:## | and the 0-offset column location
|
// indent past |name:## | and the 0-offset column location
|
||||||
let mut left = str::len(fm.name) + digits + lo.col.to_uint() + 3u;
|
let left = str::len(fm.name) + digits + lo.col.to_uint() + 3u;
|
||||||
let mut s = ~"";
|
let mut s = ~"";
|
||||||
// Skip is the number of characters we need to skip because they are
|
// Skip is the number of characters we need to skip because they are
|
||||||
// part of the 'filename:line ' part of the previous line.
|
// part of the 'filename:line ' part of the previous line.
|
||||||
|
|
|
@ -96,7 +96,7 @@ fn pieces_to_expr(cx: @ext_ctxt, sp: span,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn make_ty(cx: @ext_ctxt, sp: span, t: Ty) -> @ast::expr {
|
fn make_ty(cx: @ext_ctxt, sp: span, t: Ty) -> @ast::expr {
|
||||||
let mut rt_type;
|
let rt_type;
|
||||||
match t {
|
match t {
|
||||||
TyHex(c) => match c {
|
TyHex(c) => match c {
|
||||||
CaseUpper => rt_type = ~"TyHexUpper",
|
CaseUpper => rt_type = ~"TyHexUpper",
|
||||||
|
@ -272,6 +272,7 @@ fn pieces_to_expr(cx: @ext_ctxt, sp: span,
|
||||||
/* Translate each piece (portion of the fmt expression) by invoking the
|
/* Translate each piece (portion of the fmt expression) by invoking the
|
||||||
corresponding function in core::unstable::extfmt. Each function takes a
|
corresponding function in core::unstable::extfmt. Each function takes a
|
||||||
buffer to insert data into along with the data being formatted. */
|
buffer to insert data into along with the data being formatted. */
|
||||||
|
let npieces = pieces.len();
|
||||||
do vec::consume(pieces) |i, pc| {
|
do vec::consume(pieces) |i, pc| {
|
||||||
match pc {
|
match pc {
|
||||||
/* Raw strings get appended via str::push_str */
|
/* Raw strings get appended via str::push_str */
|
||||||
|
@ -279,9 +280,10 @@ fn pieces_to_expr(cx: @ext_ctxt, sp: span,
|
||||||
let portion = mk_uniq_str(cx, fmt_sp, s);
|
let portion = mk_uniq_str(cx, fmt_sp, s);
|
||||||
|
|
||||||
/* If this is the first portion, then initialize the local
|
/* If this is the first portion, then initialize the local
|
||||||
buffer with it directly */
|
buffer with it directly. If it's actually the only piece,
|
||||||
|
then there's no need for it to be mutable */
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
stms.push(mk_local(cx, fmt_sp, true, ident, portion));
|
stms.push(mk_local(cx, fmt_sp, npieces > 1, ident, portion));
|
||||||
} else {
|
} else {
|
||||||
let args = ~[mk_mut_addr_of(cx, fmt_sp, buf()), portion];
|
let args = ~[mk_mut_addr_of(cx, fmt_sp, buf()), portion];
|
||||||
let call = mk_call_global(cx,
|
let call = mk_call_global(cx,
|
||||||
|
|
|
@ -73,7 +73,7 @@ impl parser_attr for Parser {
|
||||||
self.expect(&token::LBRACKET);
|
self.expect(&token::LBRACKET);
|
||||||
let meta_item = self.parse_meta_item();
|
let meta_item = self.parse_meta_item();
|
||||||
self.expect(&token::RBRACKET);
|
self.expect(&token::RBRACKET);
|
||||||
let mut hi = self.span.hi;
|
let hi = self.span.hi;
|
||||||
return spanned(lo, hi, ast::attribute_ { style: style,
|
return spanned(lo, hi, ast::attribute_ { style: style,
|
||||||
value: meta_item,
|
value: meta_item,
|
||||||
is_sugared_doc: false });
|
is_sugared_doc: false });
|
||||||
|
@ -141,16 +141,16 @@ impl parser_attr for Parser {
|
||||||
token::EQ => {
|
token::EQ => {
|
||||||
self.bump();
|
self.bump();
|
||||||
let lit = self.parse_lit();
|
let lit = self.parse_lit();
|
||||||
let mut hi = self.span.hi;
|
let hi = self.span.hi;
|
||||||
@spanned(lo, hi, ast::meta_name_value(name, lit))
|
@spanned(lo, hi, ast::meta_name_value(name, lit))
|
||||||
}
|
}
|
||||||
token::LPAREN => {
|
token::LPAREN => {
|
||||||
let inner_items = self.parse_meta_seq();
|
let inner_items = self.parse_meta_seq();
|
||||||
let mut hi = self.span.hi;
|
let hi = self.span.hi;
|
||||||
@spanned(lo, hi, ast::meta_list(name, inner_items))
|
@spanned(lo, hi, ast::meta_list(name, inner_items))
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
let mut hi = self.span.hi;
|
let hi = self.span.hi;
|
||||||
@spanned(lo, hi, ast::meta_word(name))
|
@spanned(lo, hi, ast::meta_word(name))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,7 +229,7 @@ fn read_block_comment(rdr: @mut StringReader,
|
||||||
debug!(">>> block comment");
|
debug!(">>> block comment");
|
||||||
let p = rdr.last_pos;
|
let p = rdr.last_pos;
|
||||||
let mut lines: ~[~str] = ~[];
|
let mut lines: ~[~str] = ~[];
|
||||||
let mut col: CharPos = rdr.col;
|
let col: CharPos = rdr.col;
|
||||||
bump(rdr);
|
bump(rdr);
|
||||||
bump(rdr);
|
bump(rdr);
|
||||||
|
|
||||||
|
|
|
@ -810,7 +810,7 @@ pub impl Parser {
|
||||||
// This version of parse arg doesn't necessarily require
|
// This version of parse arg doesn't necessarily require
|
||||||
// identifier names.
|
// identifier names.
|
||||||
fn parse_arg_general(&self, require_name: bool) -> arg {
|
fn parse_arg_general(&self, require_name: bool) -> arg {
|
||||||
let mut m;
|
let m;
|
||||||
let mut is_mutbl = false;
|
let mut is_mutbl = false;
|
||||||
let pat = if require_name || self.is_named_argument() {
|
let pat = if require_name || self.is_named_argument() {
|
||||||
m = self.parse_arg_mode();
|
m = self.parse_arg_mode();
|
||||||
|
@ -1154,7 +1154,7 @@ pub impl Parser {
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
let mut hi = self.span.hi;
|
let mut hi = self.span.hi;
|
||||||
|
|
||||||
let mut ex: expr_;
|
let ex: expr_;
|
||||||
|
|
||||||
if *self.token == token::LPAREN {
|
if *self.token == token::LPAREN {
|
||||||
self.bump();
|
self.bump();
|
||||||
|
@ -1629,9 +1629,9 @@ pub impl Parser {
|
||||||
// parse a prefix-operator expr
|
// parse a prefix-operator expr
|
||||||
fn parse_prefix_expr(&self) -> @expr {
|
fn parse_prefix_expr(&self) -> @expr {
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
let mut hi;
|
let hi;
|
||||||
|
|
||||||
let mut ex;
|
let ex;
|
||||||
match *self.token {
|
match *self.token {
|
||||||
token::NOT => {
|
token::NOT => {
|
||||||
self.bump();
|
self.bump();
|
||||||
|
@ -1781,7 +1781,7 @@ pub impl Parser {
|
||||||
token::BINOPEQ(op) => {
|
token::BINOPEQ(op) => {
|
||||||
self.bump();
|
self.bump();
|
||||||
let rhs = self.parse_expr();
|
let rhs = self.parse_expr();
|
||||||
let mut aop;
|
let aop;
|
||||||
match op {
|
match op {
|
||||||
token::PLUS => aop = add,
|
token::PLUS => aop = add,
|
||||||
token::MINUS => aop = subtract,
|
token::MINUS => aop = subtract,
|
||||||
|
@ -1956,7 +1956,7 @@ pub impl Parser {
|
||||||
let lo = self.last_span.lo;
|
let lo = self.last_span.lo;
|
||||||
let cond = self.parse_expr();
|
let cond = self.parse_expr();
|
||||||
let body = self.parse_block_no_value();
|
let body = self.parse_block_no_value();
|
||||||
let mut hi = body.span.hi;
|
let hi = body.span.hi;
|
||||||
return self.mk_expr(lo, hi, expr_while(cond, body));
|
return self.mk_expr(lo, hi, expr_while(cond, body));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1984,7 +1984,7 @@ pub impl Parser {
|
||||||
|
|
||||||
let lo = self.last_span.lo;
|
let lo = self.last_span.lo;
|
||||||
let body = self.parse_block_no_value();
|
let body = self.parse_block_no_value();
|
||||||
let mut hi = body.span.hi;
|
let hi = body.span.hi;
|
||||||
return self.mk_expr(lo, hi, expr_loop(body, opt_ident));
|
return self.mk_expr(lo, hi, expr_loop(body, opt_ident));
|
||||||
} else {
|
} else {
|
||||||
// This is a 'continue' expression
|
// This is a 'continue' expression
|
||||||
|
@ -2043,7 +2043,7 @@ pub impl Parser {
|
||||||
|
|
||||||
arms.push(ast::arm { pats: pats, guard: guard, body: blk });
|
arms.push(ast::arm { pats: pats, guard: guard, body: blk });
|
||||||
}
|
}
|
||||||
let mut hi = self.span.hi;
|
let hi = self.span.hi;
|
||||||
self.bump();
|
self.bump();
|
||||||
return self.mk_expr(lo, hi, expr_match(discriminant, arms));
|
return self.mk_expr(lo, hi, expr_match(discriminant, arms));
|
||||||
}
|
}
|
||||||
|
@ -2162,7 +2162,7 @@ pub impl Parser {
|
||||||
let hi1 = self.last_span.lo;
|
let hi1 = self.last_span.lo;
|
||||||
let fieldpath = ast_util::ident_to_path(mk_sp(lo1, hi1),
|
let fieldpath = ast_util::ident_to_path(mk_sp(lo1, hi1),
|
||||||
fieldname);
|
fieldname);
|
||||||
let mut subpat;
|
let subpat;
|
||||||
if *self.token == token::COLON {
|
if *self.token == token::COLON {
|
||||||
self.bump();
|
self.bump();
|
||||||
subpat = self.parse_pat(refutable);
|
subpat = self.parse_pat(refutable);
|
||||||
|
@ -2183,7 +2183,7 @@ pub impl Parser {
|
||||||
|
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
let mut hi = self.span.hi;
|
let mut hi = self.span.hi;
|
||||||
let mut pat;
|
let pat;
|
||||||
match *self.token {
|
match *self.token {
|
||||||
token::UNDERSCORE => { self.bump(); pat = pat_wild; }
|
token::UNDERSCORE => { self.bump(); pat = pat_wild; }
|
||||||
token::AT => {
|
token::AT => {
|
||||||
|
@ -2534,7 +2534,7 @@ pub impl Parser {
|
||||||
match self.parse_item_or_view_item(/*bad*/ copy item_attrs,
|
match self.parse_item_or_view_item(/*bad*/ copy item_attrs,
|
||||||
true, false, false) {
|
true, false, false) {
|
||||||
iovi_item(i) => {
|
iovi_item(i) => {
|
||||||
let mut hi = i.span.hi;
|
let hi = i.span.hi;
|
||||||
let decl = @spanned(lo, hi, decl_item(i));
|
let decl = @spanned(lo, hi, decl_item(i));
|
||||||
return @spanned(lo, hi, stmt_decl(decl, self.get_id()));
|
return @spanned(lo, hi, stmt_decl(decl, self.get_id()));
|
||||||
}
|
}
|
||||||
|
@ -2704,7 +2704,7 @@ pub impl Parser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let mut hi = self.span.hi;
|
let hi = self.span.hi;
|
||||||
self.bump();
|
self.bump();
|
||||||
let bloc = ast::blk_ {
|
let bloc = ast::blk_ {
|
||||||
view_items: view_items,
|
view_items: view_items,
|
||||||
|
@ -3590,7 +3590,7 @@ pub impl Parser {
|
||||||
let purity = self.parse_fn_purity();
|
let purity = self.parse_fn_purity();
|
||||||
let (ident, generics) = self.parse_fn_header();
|
let (ident, generics) = self.parse_fn_header();
|
||||||
let decl = self.parse_fn_decl(|p| p.parse_arg());
|
let decl = self.parse_fn_decl(|p| p.parse_arg());
|
||||||
let mut hi = self.span.hi;
|
let hi = self.span.hi;
|
||||||
self.expect(&token::SEMI);
|
self.expect(&token::SEMI);
|
||||||
@ast::foreign_item { ident: ident,
|
@ast::foreign_item { ident: ident,
|
||||||
attrs: attrs,
|
attrs: attrs,
|
||||||
|
@ -3798,7 +3798,7 @@ pub impl Parser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.bump();
|
self.bump();
|
||||||
let mut actual_dtor = do the_dtor.map |dtor| {
|
let actual_dtor = do the_dtor.map |dtor| {
|
||||||
let (d_body, d_attrs, d_s) = copy *dtor;
|
let (d_body, d_attrs, d_s) = copy *dtor;
|
||||||
codemap::spanned { node: ast::struct_dtor_ { id: self.get_id(),
|
codemap::spanned { node: ast::struct_dtor_ { id: self.get_id(),
|
||||||
attrs: d_attrs,
|
attrs: d_attrs,
|
||||||
|
|
|
@ -146,9 +146,9 @@ pub fn mk_printer(out: @io::Writer, linewidth: uint) -> @mut Printer {
|
||||||
// fall behind.
|
// fall behind.
|
||||||
let n: uint = 3 * linewidth;
|
let n: uint = 3 * linewidth;
|
||||||
debug!("mk_printer %u", linewidth);
|
debug!("mk_printer %u", linewidth);
|
||||||
let mut token: ~[token] = vec::from_elem(n, EOF);
|
let token: ~[token] = vec::from_elem(n, EOF);
|
||||||
let mut size: ~[int] = vec::from_elem(n, 0);
|
let size: ~[int] = vec::from_elem(n, 0);
|
||||||
let mut scan_stack: ~[uint] = vec::from_elem(n, 0u);
|
let scan_stack: ~[uint] = vec::from_elem(n, 0u);
|
||||||
@mut Printer {
|
@mut Printer {
|
||||||
out: @out,
|
out: @out,
|
||||||
buf_len: n,
|
buf_len: n,
|
||||||
|
|
|
@ -1972,7 +1972,7 @@ pub fn print_ty_fn(s: @ps,
|
||||||
|
|
||||||
pub fn maybe_print_trailing_comment(s: @ps, span: codemap::span,
|
pub fn maybe_print_trailing_comment(s: @ps, span: codemap::span,
|
||||||
next_pos: Option<BytePos>) {
|
next_pos: Option<BytePos>) {
|
||||||
let mut cm;
|
let cm;
|
||||||
match s.cm { Some(ccm) => cm = ccm, _ => return }
|
match s.cm { Some(ccm) => cm = ccm, _ => return }
|
||||||
match next_comment(s) {
|
match next_comment(s) {
|
||||||
Some(ref cmnt) => {
|
Some(ref cmnt) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue