Skip to content

Commit

Permalink
rustc: remove unused 'mut' variables
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Apr 21, 2013
1 parent fd97cac commit c389d0b
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 34 deletions.
6 changes: 3 additions & 3 deletions src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ pub mod write {
let LLVMOptDefault = 2 as c_int; // -O2, -Os
let LLVMOptAggressive = 3 as c_int; // -O3

let mut CodeGenOptLevel = match opts.optimize {
let CodeGenOptLevel = match opts.optimize {
session::No => LLVMOptNone,
session::Less => LLVMOptLess,
session::Default => LLVMOptDefault,
Expand All @@ -294,7 +294,7 @@ pub mod write {
return;
}

let mut FileType;
let FileType;
if output_type == output_type_object ||
output_type == output_type_exe {
FileType = lib::llvm::ObjectFile;
Expand Down Expand Up @@ -820,7 +820,7 @@ pub fn link_binary(sess: Session,
cc_args.push(output.to_str());
cc_args.push(obj_filename.to_str());
let mut lib_cmd;
let lib_cmd;
let os = sess.targ_cfg.os;
if os == session::os_macos {
lib_cmd = ~"-dynamiclib";
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ pub fn compile_upto(sess: Session, cfg: ast::crate_cfg,
outputs: Option<@OutputFilenames>)
-> (@ast::crate, Option<ty::ctxt>) {
let time_passes = sess.time_passes();
let mut crate = time(time_passes, ~"parsing",
let crate = time(time_passes, ~"parsing",
|| parse_input(sess, copy cfg, input) );
if upto == cu_parse { return (crate, None); }

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,7 @@ pub static metadata_encoding_version : &'static [u8] =
pub fn encode_metadata(parms: EncodeParams, crate: &crate) -> ~[u8] {
let wr = @io::BytesWriter();
let mut stats = Stats {
let stats = Stats {
inline_bytes: 0,
attr_bytes: 0,
dep_bytes: 0,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/borrowck/gather_loans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ pub impl GatherLoanCtxt {
let mcx = &mem_categorization_ctxt {
tcx: self.tcx(),
method_map: self.bccx.method_map};
let mut cmt = mcx.cat_expr_autoderefd(expr, autoderefs);
let cmt = mcx.cat_expr_autoderefd(expr, autoderefs);
debug!("after autoderef, cmt=%s", self.bccx.cmt_to_repr(cmt));

match autoref.kind {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/borrowck/loan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use middle::mem_categorization::{cat_arg, cat_binding, cat_discr, cat_comp};
use middle::mem_categorization::{cat_deref, cat_discr, cat_local, cat_self};
use middle::mem_categorization::{cat_special, cat_stack_upvar, cmt};
use middle::mem_categorization::{comp_field, comp_index, comp_variant};
use middle::mem_categorization::{gc_ptr, region_ptr, lp_local, lp_arg};
use middle::mem_categorization::{gc_ptr, region_ptr};
use middle::ty;
use util::common::indenter;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ pub fn specialize(cx: @MatchCheckCtxt,
left_ty: ty::t)
-> Option<~[@pat]> {
// Sad, but I can't get rid of this easily
let mut r0 = copy *raw_pat(r[0]);
let r0 = copy *raw_pat(r[0]);
match r0 {
pat{id: pat_id, node: n, span: pat_span} =>
match n {
Expand Down
18 changes: 9 additions & 9 deletions src/librustc/middle/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ pub impl Resolver {
// child name directly. Otherwise, we create or reuse an anonymous
// module and add the child to that.
let mut module_;
let module_;
match reduced_graph_parent {
ModuleReducedGraphParent(parent_module) => {
module_ = parent_module;
Expand Down Expand Up @@ -1527,7 +1527,7 @@ pub impl Resolver {
block: &blk,
parent: ReducedGraphParent,
visitor: vt<ReducedGraphParent>) {
let mut new_parent;
let new_parent;
if self.block_needs_anonymous_module(block) {
let block_id = block.node.id;
Expand Down Expand Up @@ -2427,7 +2427,7 @@ pub impl Resolver {

let merge_import_resolution = |ident,
name_bindings: @mut NameBindings| {
let mut dest_import_resolution;
let dest_import_resolution;
match module_.import_resolutions.find(ident) {
None => {
// Create a new import resolution from this child.
Expand Down Expand Up @@ -2583,8 +2583,8 @@ pub impl Resolver {
let module_prefix_result = self.resolve_module_prefix(module_,
module_path);

let mut search_module;
let mut start_index;
let search_module;
let start_index;
match module_prefix_result {
Failed => {
self.session.span_err(span, ~"unresolved name");
Expand Down Expand Up @@ -3221,7 +3221,7 @@ pub impl Resolver {
allow_capturing_self: AllowCapturingSelfFlag)
-> Option<def_like> {
let mut def;
let mut is_ty_param;
let is_ty_param;

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

let mut containing_module;
let containing_module;
match self.resolve_module_path_for_import(self.current_module,
module_path_idents,
UseLexicalScope,
Expand Down Expand Up @@ -4578,7 +4578,7 @@ pub impl Resolver {
let root_module = self.graph_root.get_module();
let mut containing_module;
let containing_module;
match self.resolve_module_path_from_root(root_module,
module_path_idents,
0,
Expand Down Expand Up @@ -4622,7 +4622,7 @@ pub impl Resolver {
span: span)
-> Option<def> {
// Check the local set of ribs.
let mut search_result;
let search_result;
match namespace {
ValueNS => {
search_result = self.search_ribs(&mut self.value_ribs, ident,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ pub enum opt_result {
pub fn trans_opt(bcx: block, o: &Opt) -> opt_result {
let _icx = bcx.insn_ctxt("match::trans_opt");
let ccx = bcx.ccx();
let mut bcx = bcx;
let bcx = bcx;
match *o {
lit(ExprLit(lit_expr)) => {
let datumblock = expr::trans_to_datum(bcx, lit_expr);
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/trans/callee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ pub fn trans_fn_ref_with_vtables(
}

// Find the actual function pointer.
let mut val = {
let val = {
if def_id.crate == ast::local_crate {
// Internal reference.
get_item_val(ccx, def_id.node)
Expand Down Expand Up @@ -415,7 +415,7 @@ pub fn trans_lang_call_with_type_params(bcx: block,
type_params,
None,
fty);
let mut llfnty = type_of::type_of(callee.bcx.ccx(),
let llfnty = type_of::type_of(callee.bcx.ccx(),
substituted);
new_llval = PointerCast(callee.bcx, fn_data.llfn, llfnty);
}
Expand Down Expand Up @@ -712,7 +712,7 @@ pub fn trans_arg_expr(bcx: block,
}
};
let mut arg_datum = arg_datumblock.datum;
let mut bcx = arg_datumblock.bcx;
let bcx = arg_datumblock.bcx;

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

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ pub fn build_closure(bcx0: block,
include_ret_handle: Option<ValueRef>) -> ClosureResult {
let _icx = bcx0.insn_ctxt("closure::build_closure");
// If we need to, package up the iterator body to call
let mut bcx = bcx0;;
let bcx = bcx0;;
let ccx = bcx.ccx(), tcx = ccx.tcx;

// Package up the captured upvars
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/trans/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ pub fn trans_to_datum(bcx: block, expr: @ast::expr) -> DatumBlock {
}
Some(&@AutoAddEnv(*)) => {
let mut bcx = bcx;
let mut datum = unpack_datum!(bcx, {
let datum = unpack_datum!(bcx, {
trans_to_datum_unadjusted(bcx, expr)
});
add_env(bcx, expr, datum)
Expand Down Expand Up @@ -1187,7 +1187,7 @@ fn trans_rec_or_struct(bcx: block,
dest: Dest) -> block
{
let _icx = bcx.insn_ctxt("trans_rec");
let mut bcx = bcx;
let bcx = bcx;

let ty = node_id_type(bcx, id);
let tcx = bcx.tcx();
Expand Down Expand Up @@ -1505,7 +1505,7 @@ fn trans_lazy_binop(bcx: block,
b: @ast::expr) -> DatumBlock {
let _icx = bcx.insn_ctxt("trans_lazy_binop");
let binop_ty = expr_ty(bcx, binop_expr);
let mut bcx = bcx;
let bcx = bcx;

let Result {bcx: past_lhs, val: lhs} = {
do base::with_scope_result(bcx, a.info(), ~"lhs") |bcx| {
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/middle/trans/foreign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,8 @@ pub fn trans_intrinsic(ccx: @CrateContext,
set_fixed_stack_segment(fcx.llfn);
}

let mut bcx = top_scope_block(fcx, None), lltop = bcx.llbb;
let mut bcx = top_scope_block(fcx, None);
let lltop = bcx.llbb;
match *ccx.sess.str_of(item.ident) {
~"atomic_cxchg" => {
let old = AtomicCmpXchg(bcx,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/monomorphize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub fn monomorphic_fn(ccx: @CrateContext,
}

let tpt = ty::lookup_item_type(ccx.tcx, fn_id);
let mut llitem_ty = tpt.ty;
let llitem_ty = tpt.ty;

let map_node = session::expect(ccx.sess, ccx.tcx.items.find(&fn_id.node),
|| fmt!("While monomorphizing %?, couldn't find it in the item map \
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/typeck/check/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ pub struct Candidate {

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

Expand Down
9 changes: 5 additions & 4 deletions src/librustc/middle/typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1625,7 +1625,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
// block syntax lambdas; that is, lambdas without explicit
// sigils.
let expected_sty = unpack_expected(fcx, expected, |x| Some(copy *x));
let mut error_happened = false;
let error_happened = false;
let (expected_sig,
expected_purity,
expected_sigil,
Expand Down Expand Up @@ -1706,7 +1706,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
field: ast::ident,
tys: &[@ast::Ty]) {
let tcx = fcx.ccx.tcx;
let mut bot = check_expr(fcx, base);
let bot = check_expr(fcx, base);
let expr_t = structurally_resolved_type(fcx, expr.span,
fcx.expr_ty(base));
let (base_t, derefs) = do_autoderef(fcx, expr.span, expr_t);
Expand Down Expand Up @@ -2867,7 +2867,7 @@ pub fn check_decl_local(fcx: @mut FnCtxt, local: @ast::local) {
}

pub fn check_stmt(fcx: @mut FnCtxt, stmt: @ast::stmt) {
let mut node_id;
let node_id;
let mut saw_bot = false;
let mut saw_err = false;
match stmt.node {
Expand Down Expand Up @@ -3124,7 +3124,8 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt,
ccx.tcx.enum_var_cache.insert(local_def(id), @variants);

// Check that it is possible to represent this enum:
let mut outer = true, did = local_def(id);
let mut outer = true;
let did = local_def(id);
if ty::type_structurally_contains(ccx.tcx, rty, |sty| {
match *sty {
ty::ty_enum(id, _) if id == did => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/typeck/check/vtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use core::prelude::*;

use middle::resolve::Impl;
use middle::ty::{param_ty};
use middle::ty::param_ty;
use middle::ty;
use middle::typeck::check::{FnCtxt, impl_self_ty};
use middle::typeck::check::{structurally_resolved_type};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/typeck/rscope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl MethodRscope {
variance: Option<ty::region_variance>,
rcvr_generics: &ast::Generics)
-> MethodRscope {
let mut region_param_names =
let region_param_names =
RegionParamNames::from_generics(rcvr_generics);
MethodRscope {
self_ty: self_ty,
Expand Down

5 comments on commit c389d0b

@bors
Copy link
Contributor

@bors bors commented on c389d0b Apr 22, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from graydon
at alexcrichton@c389d0b

@bors
Copy link
Contributor

@bors bors commented on c389d0b Apr 22, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging alexcrichton/rust/issue-3083 = c389d0b into auto

@bors
Copy link
Contributor

@bors bors commented on c389d0b Apr 22, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alexcrichton/rust/issue-3083 = c389d0b merged ok, testing candidate = aba93c6

@bors
Copy link
Contributor

@bors bors commented on c389d0b Apr 22, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on c389d0b Apr 22, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding incoming to auto = aba93c6

Please sign in to comment.