rustc: remove unused 'mut' variables

This commit is contained in:
Alex Crichton 2013-04-12 01:15:30 -04:00
parent fd97cac251
commit c389d0b0dd
17 changed files with 36 additions and 34 deletions

View file

@ -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,
@ -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;
@ -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";

View file

@ -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); }

View file

@ -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,

View file

@ -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 {

View file

@ -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;

View file

@ -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 {

View file

@ -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;
@ -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;
@ -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.
@ -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");
@ -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(*)) |
@ -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,
@ -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,
@ -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,

View file

@ -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);

View file

@ -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)
@ -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);
}
@ -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()));

View file

@ -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

View file

@ -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)
@ -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();
@ -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| {

View file

@ -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,

View file

@ -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 \

View file

@ -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);

View file

@ -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,
@ -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);
@ -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 {
@ -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 => {

View file

@ -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};

View file

@ -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,