Skip to content

Commit c389d0b

Browse files
committed
rustc: remove unused 'mut' variables
1 parent fd97cac commit c389d0b

File tree

17 files changed

+36
-34
lines changed

17 files changed

+36
-34
lines changed

src/librustc/back/link.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ pub mod write {
273273
let LLVMOptDefault = 2 as c_int; // -O2, -Os
274274
let LLVMOptAggressive = 3 as c_int; // -O3
275275

276-
let mut CodeGenOptLevel = match opts.optimize {
276+
let CodeGenOptLevel = match opts.optimize {
277277
session::No => LLVMOptNone,
278278
session::Less => LLVMOptLess,
279279
session::Default => LLVMOptDefault,
@@ -294,7 +294,7 @@ pub mod write {
294294
return;
295295
}
296296

297-
let mut FileType;
297+
let FileType;
298298
if output_type == output_type_object ||
299299
output_type == output_type_exe {
300300
FileType = lib::llvm::ObjectFile;
@@ -820,7 +820,7 @@ pub fn link_binary(sess: Session,
820820
cc_args.push(output.to_str());
821821
cc_args.push(obj_filename.to_str());
822822
823-
let mut lib_cmd;
823+
let lib_cmd;
824824
let os = sess.targ_cfg.os;
825825
if os == session::os_macos {
826826
lib_cmd = ~"-dynamiclib";

src/librustc/driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ pub fn compile_upto(sess: Session, cfg: ast::crate_cfg,
349349
outputs: Option<@OutputFilenames>)
350350
-> (@ast::crate, Option<ty::ctxt>) {
351351
let time_passes = sess.time_passes();
352-
let mut crate = time(time_passes, ~"parsing",
352+
let crate = time(time_passes, ~"parsing",
353353
|| parse_input(sess, copy cfg, input) );
354354
if upto == cu_parse { return (crate, None); }
355355

src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ pub static metadata_encoding_version : &'static [u8] =
13411341
13421342
pub fn encode_metadata(parms: EncodeParams, crate: &crate) -> ~[u8] {
13431343
let wr = @io::BytesWriter();
1344-
let mut stats = Stats {
1344+
let stats = Stats {
13451345
inline_bytes: 0,
13461346
attr_bytes: 0,
13471347
dep_bytes: 0,

src/librustc/middle/borrowck/gather_loans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ pub impl GatherLoanCtxt {
305305
let mcx = &mem_categorization_ctxt {
306306
tcx: self.tcx(),
307307
method_map: self.bccx.method_map};
308-
let mut cmt = mcx.cat_expr_autoderefd(expr, autoderefs);
308+
let cmt = mcx.cat_expr_autoderefd(expr, autoderefs);
309309
debug!("after autoderef, cmt=%s", self.bccx.cmt_to_repr(cmt));
310310

311311
match autoref.kind {

src/librustc/middle/borrowck/loan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ use middle::mem_categorization::{cat_arg, cat_binding, cat_discr, cat_comp};
5151
use middle::mem_categorization::{cat_deref, cat_discr, cat_local, cat_self};
5252
use middle::mem_categorization::{cat_special, cat_stack_upvar, cmt};
5353
use middle::mem_categorization::{comp_field, comp_index, comp_variant};
54-
use middle::mem_categorization::{gc_ptr, region_ptr, lp_local, lp_arg};
54+
use middle::mem_categorization::{gc_ptr, region_ptr};
5555
use middle::ty;
5656
use util::common::indenter;
5757

src/librustc/middle/check_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ pub fn specialize(cx: @MatchCheckCtxt,
481481
left_ty: ty::t)
482482
-> Option<~[@pat]> {
483483
// Sad, but I can't get rid of this easily
484-
let mut r0 = copy *raw_pat(r[0]);
484+
let r0 = copy *raw_pat(r[0]);
485485
match r0 {
486486
pat{id: pat_id, node: n, span: pat_span} =>
487487
match n {

src/librustc/middle/resolve.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ pub impl Resolver {
960960
// child name directly. Otherwise, we create or reuse an anonymous
961961
// module and add the child to that.
962962
963-
let mut module_;
963+
let module_;
964964
match reduced_graph_parent {
965965
ModuleReducedGraphParent(parent_module) => {
966966
module_ = parent_module;
@@ -1527,7 +1527,7 @@ pub impl Resolver {
15271527
block: &blk,
15281528
parent: ReducedGraphParent,
15291529
visitor: vt<ReducedGraphParent>) {
1530-
let mut new_parent;
1530+
let new_parent;
15311531
if self.block_needs_anonymous_module(block) {
15321532
let block_id = block.node.id;
15331533
@@ -2427,7 +2427,7 @@ pub impl Resolver {
24272427

24282428
let merge_import_resolution = |ident,
24292429
name_bindings: @mut NameBindings| {
2430-
let mut dest_import_resolution;
2430+
let dest_import_resolution;
24312431
match module_.import_resolutions.find(ident) {
24322432
None => {
24332433
// Create a new import resolution from this child.
@@ -2583,8 +2583,8 @@ pub impl Resolver {
25832583
let module_prefix_result = self.resolve_module_prefix(module_,
25842584
module_path);
25852585

2586-
let mut search_module;
2587-
let mut start_index;
2586+
let search_module;
2587+
let start_index;
25882588
match module_prefix_result {
25892589
Failed => {
25902590
self.session.span_err(span, ~"unresolved name");
@@ -3221,7 +3221,7 @@ pub impl Resolver {
32213221
allow_capturing_self: AllowCapturingSelfFlag)
32223222
-> Option<def_like> {
32233223
let mut def;
3224-
let mut is_ty_param;
3224+
let is_ty_param;
32253225

32263226
match def_like {
32273227
dl_def(d @ def_local(*)) | dl_def(d @ def_upvar(*)) |
@@ -4530,7 +4530,7 @@ pub impl Resolver {
45304530
-> Option<def> {
45314531
let module_path_idents = self.intern_module_part_of_path(path);
45324532

4533-
let mut containing_module;
4533+
let containing_module;
45344534
match self.resolve_module_path_for_import(self.current_module,
45354535
module_path_idents,
45364536
UseLexicalScope,
@@ -4578,7 +4578,7 @@ pub impl Resolver {
45784578
45794579
let root_module = self.graph_root.get_module();
45804580
4581-
let mut containing_module;
4581+
let containing_module;
45824582
match self.resolve_module_path_from_root(root_module,
45834583
module_path_idents,
45844584
0,
@@ -4622,7 +4622,7 @@ pub impl Resolver {
46224622
span: span)
46234623
-> Option<def> {
46244624
// Check the local set of ribs.
4625-
let mut search_result;
4625+
let search_result;
46264626
match namespace {
46274627
ValueNS => {
46284628
search_result = self.search_ribs(&mut self.value_ribs, ident,

src/librustc/middle/trans/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ pub enum opt_result {
248248
pub fn trans_opt(bcx: block, o: &Opt) -> opt_result {
249249
let _icx = bcx.insn_ctxt("match::trans_opt");
250250
let ccx = bcx.ccx();
251-
let mut bcx = bcx;
251+
let bcx = bcx;
252252
match *o {
253253
lit(ExprLit(lit_expr)) => {
254254
let datumblock = expr::trans_to_datum(bcx, lit_expr);

src/librustc/middle/trans/callee.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ pub fn trans_fn_ref_with_vtables(
292292
}
293293

294294
// Find the actual function pointer.
295-
let mut val = {
295+
let val = {
296296
if def_id.crate == ast::local_crate {
297297
// Internal reference.
298298
get_item_val(ccx, def_id.node)
@@ -415,7 +415,7 @@ pub fn trans_lang_call_with_type_params(bcx: block,
415415
type_params,
416416
None,
417417
fty);
418-
let mut llfnty = type_of::type_of(callee.bcx.ccx(),
418+
let llfnty = type_of::type_of(callee.bcx.ccx(),
419419
substituted);
420420
new_llval = PointerCast(callee.bcx, fn_data.llfn, llfnty);
421421
}
@@ -712,7 +712,7 @@ pub fn trans_arg_expr(bcx: block,
712712
}
713713
};
714714
let mut arg_datum = arg_datumblock.datum;
715-
let mut bcx = arg_datumblock.bcx;
715+
let bcx = arg_datumblock.bcx;
716716

717717
debug!(" arg datum: %s", arg_datum.to_str(bcx.ccx()));
718718

src/librustc/middle/trans/closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ pub fn build_closure(bcx0: block,
261261
include_ret_handle: Option<ValueRef>) -> ClosureResult {
262262
let _icx = bcx0.insn_ctxt("closure::build_closure");
263263
// If we need to, package up the iterator body to call
264-
let mut bcx = bcx0;;
264+
let bcx = bcx0;;
265265
let ccx = bcx.ccx(), tcx = ccx.tcx;
266266

267267
// Package up the captured upvars

src/librustc/middle/trans/expr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub fn trans_to_datum(bcx: block, expr: @ast::expr) -> DatumBlock {
192192
}
193193
Some(&@AutoAddEnv(*)) => {
194194
let mut bcx = bcx;
195-
let mut datum = unpack_datum!(bcx, {
195+
let datum = unpack_datum!(bcx, {
196196
trans_to_datum_unadjusted(bcx, expr)
197197
});
198198
add_env(bcx, expr, datum)
@@ -1187,7 +1187,7 @@ fn trans_rec_or_struct(bcx: block,
11871187
dest: Dest) -> block
11881188
{
11891189
let _icx = bcx.insn_ctxt("trans_rec");
1190-
let mut bcx = bcx;
1190+
let bcx = bcx;
11911191

11921192
let ty = node_id_type(bcx, id);
11931193
let tcx = bcx.tcx();
@@ -1505,7 +1505,7 @@ fn trans_lazy_binop(bcx: block,
15051505
b: @ast::expr) -> DatumBlock {
15061506
let _icx = bcx.insn_ctxt("trans_lazy_binop");
15071507
let binop_ty = expr_ty(bcx, binop_expr);
1508-
let mut bcx = bcx;
1508+
let bcx = bcx;
15091509

15101510
let Result {bcx: past_lhs, val: lhs} = {
15111511
do base::with_scope_result(bcx, a.info(), ~"lhs") |bcx| {

src/librustc/middle/trans/foreign.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,8 @@ pub fn trans_intrinsic(ccx: @CrateContext,
567567
set_fixed_stack_segment(fcx.llfn);
568568
}
569569

570-
let mut bcx = top_scope_block(fcx, None), lltop = bcx.llbb;
570+
let mut bcx = top_scope_block(fcx, None);
571+
let lltop = bcx.llbb;
571572
match *ccx.sess.str_of(item.ident) {
572573
~"atomic_cxchg" => {
573574
let old = AtomicCmpXchg(bcx,

src/librustc/middle/trans/monomorphize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pub fn monomorphic_fn(ccx: @CrateContext,
102102
}
103103

104104
let tpt = ty::lookup_item_type(ccx.tcx, fn_id);
105-
let mut llitem_ty = tpt.ty;
105+
let llitem_ty = tpt.ty;
106106

107107
let map_node = session::expect(ccx.sess, ccx.tcx.items.find(&fn_id.node),
108108
|| fmt!("While monomorphizing %?, couldn't find it in the item map \

src/librustc/middle/typeck/check/method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ pub struct Candidate {
180180

181181
pub impl<'self> LookupContext<'self> {
182182
fn do_lookup(&self, self_ty: ty::t) -> Option<method_map_entry> {
183-
let mut self_ty = structurally_resolved_type(self.fcx,
183+
let self_ty = structurally_resolved_type(self.fcx,
184184
self.self_expr.span,
185185
self_ty);
186186

src/librustc/middle/typeck/check/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
16251625
// block syntax lambdas; that is, lambdas without explicit
16261626
// sigils.
16271627
let expected_sty = unpack_expected(fcx, expected, |x| Some(copy *x));
1628-
let mut error_happened = false;
1628+
let error_happened = false;
16291629
let (expected_sig,
16301630
expected_purity,
16311631
expected_sigil,
@@ -1706,7 +1706,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
17061706
field: ast::ident,
17071707
tys: &[@ast::Ty]) {
17081708
let tcx = fcx.ccx.tcx;
1709-
let mut bot = check_expr(fcx, base);
1709+
let bot = check_expr(fcx, base);
17101710
let expr_t = structurally_resolved_type(fcx, expr.span,
17111711
fcx.expr_ty(base));
17121712
let (base_t, derefs) = do_autoderef(fcx, expr.span, expr_t);
@@ -2867,7 +2867,7 @@ pub fn check_decl_local(fcx: @mut FnCtxt, local: @ast::local) {
28672867
}
28682868

28692869
pub fn check_stmt(fcx: @mut FnCtxt, stmt: @ast::stmt) {
2870-
let mut node_id;
2870+
let node_id;
28712871
let mut saw_bot = false;
28722872
let mut saw_err = false;
28732873
match stmt.node {
@@ -3124,7 +3124,8 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt,
31243124
ccx.tcx.enum_var_cache.insert(local_def(id), @variants);
31253125

31263126
// Check that it is possible to represent this enum:
3127-
let mut outer = true, did = local_def(id);
3127+
let mut outer = true;
3128+
let did = local_def(id);
31283129
if ty::type_structurally_contains(ccx.tcx, rty, |sty| {
31293130
match *sty {
31303131
ty::ty_enum(id, _) if id == did => {

src/librustc/middle/typeck/check/vtable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use core::prelude::*;
1212

1313
use middle::resolve::Impl;
14-
use middle::ty::{param_ty};
14+
use middle::ty::param_ty;
1515
use middle::ty;
1616
use middle::typeck::check::{FnCtxt, impl_self_ty};
1717
use middle::typeck::check::{structurally_resolved_type};

src/librustc/middle/typeck/rscope.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl MethodRscope {
158158
variance: Option<ty::region_variance>,
159159
rcvr_generics: &ast::Generics)
160160
-> MethodRscope {
161-
let mut region_param_names =
161+
let region_param_names =
162162
RegionParamNames::from_generics(rcvr_generics);
163163
MethodRscope {
164164
self_ty: self_ty,

0 commit comments

Comments
 (0)