Skip to content

Commit 3fb1ed0

Browse files
committed
rustc: Remove all usage of manual deref()
Favor using '*' instead
1 parent 76f0b1a commit 3fb1ed0

File tree

27 files changed

+61
-68
lines changed

27 files changed

+61
-68
lines changed

src/librustc/driver/driver.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,8 @@ fn write_out_deps(sess: &Session,
543543
// write Makefile-compatible dependency rules
544544
let files: Vec<~str> = sess.codemap().files.borrow()
545545
.iter().filter_map(|fmap| {
546-
if fmap.deref().is_real_file() {
547-
Some(fmap.deref().name.clone())
546+
if fmap.is_real_file() {
547+
Some(fmap.name.clone())
548548
} else {
549549
None
550550
}
@@ -682,7 +682,7 @@ pub fn pretty_print_input(sess: Session,
682682
};
683683

684684
let src_name = source_name(input);
685-
let src = sess.codemap().get_filemap(src_name).deref().src.as_bytes().to_owned();
685+
let src = sess.codemap().get_filemap(src_name).src.as_bytes().to_owned();
686686
let mut rdr = MemReader::new(src);
687687

688688
match ppm {

src/librustc/middle/astencode.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,8 +1045,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
10451045
ebml_w.tag(c::tag_table_capture_map, |ebml_w| {
10461046
ebml_w.id(id);
10471047
ebml_w.tag(c::tag_table_val, |ebml_w| {
1048-
ebml_w.emit_from_vec(cap_vars.deref().as_slice(),
1049-
|ebml_w, cap_var| {
1048+
ebml_w.emit_from_vec(cap_vars.as_slice(), |ebml_w, cap_var| {
10501049
cap_var.encode(ebml_w);
10511050
})
10521051
})

src/librustc/middle/borrowck/check_loans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ impl<'a> CheckLoanCtxt<'a> {
710710
fn check_captured_variables(&self,
711711
closure_id: ast::NodeId,
712712
span: Span) {
713-
for cap_var in self.bccx.capture_map.get(&closure_id).deref().iter() {
713+
for cap_var in self.bccx.capture_map.get(&closure_id).iter() {
714714
let var_id = ast_util::def_id_of_def(cap_var.def).node;
715715
let var_path = @LpVar(var_id);
716716
self.check_if_path_is_moved(closure_id, span,

src/librustc/middle/borrowck/gather_loans/gather_moves.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub fn gather_move_from_pat(bccx: &BorrowckCtxt,
4747
pub fn gather_captures(bccx: &BorrowckCtxt,
4848
move_data: &MoveData,
4949
closure_expr: &ast::Expr) {
50-
for captured_var in bccx.capture_map.get(&closure_expr.id).deref().iter() {
50+
for captured_var in bccx.capture_map.get(&closure_expr.id).iter() {
5151
match captured_var.mode {
5252
moves::CapMove => {
5353
let cmt = bccx.cat_captured_var(closure_expr.id,

src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ impl<'a> GatherLoanCtxt<'a> {
452452

453453
fn guarantee_captures(&mut self,
454454
closure_expr: &ast::Expr) {
455-
for captured_var in self.bccx.capture_map.get(&closure_expr.id).deref().iter() {
455+
for captured_var in self.bccx.capture_map.get(&closure_expr.id).iter() {
456456
match captured_var.mode {
457457
moves::CapCopy | moves::CapMove => { continue; }
458458
moves::CapRef => { }

src/librustc/middle/const_eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ pub fn lit_to_const(lit: &Lit) -> const_val {
490490
match lit.node {
491491
LitStr(ref s, _) => const_str((*s).clone()),
492492
LitBinary(ref data) => {
493-
const_binary(Rc::new(data.deref().iter().map(|x| *x).collect()))
493+
const_binary(Rc::new(data.iter().map(|x| *x).collect()))
494494
}
495495
LitChar(n) => const_uint(n as u64),
496496
LitInt(n, _) => const_int(n),

src/librustc/middle/kind.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ pub fn check_expr(cx: &mut Context, e: &Expr) {
291291
}
292292
}
293293
};
294-
let type_param_defs = type_param_defs.deref();
295294
if ts.len() != type_param_defs.len() {
296295
// Fail earlier to make debugging easier
297296
fail!("internal error: in kind::check_expr, length \

src/librustc/middle/liveness.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ fn visit_expr(ir: &mut IrMaps, expr: &Expr) {
472472
// in better error messages than just pointing at the closure
473473
// construction site.
474474
let mut call_caps = Vec::new();
475-
for cv in ir.capture_map.get(&expr.id).deref().iter() {
475+
for cv in ir.capture_map.get(&expr.id).iter() {
476476
match moves::moved_variable_node_id_from_def(cv.def) {
477477
Some(rv) => {
478478
let cv_ln = ir.add_live_node(FreeVarNode(cv.span));
@@ -979,7 +979,7 @@ impl<'a> Liveness<'a> {
979979
this.ir.tcx.sess.span_bug(expr.span, "no registered caps");
980980
}
981981
};
982-
caps.deref().iter().rev().fold(succ, |succ, cap| {
982+
caps.iter().rev().fold(succ, |succ, cap| {
983983
this.init_from_succ(cap.ln, succ);
984984
let var = this.variable(cap.var_nid, expr.span);
985985
this.acc(cap.ln, var, ACC_READ | ACC_USE);

src/librustc/middle/subst.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl<T:Subst> Subst for Rc<T> {
141141
fn subst_spanned(&self, tcx: &ty::ctxt,
142142
substs: &ty::substs,
143143
span: Option<Span>) -> Rc<T> {
144-
Rc::new(self.deref().subst_spanned(tcx, substs, span))
144+
Rc::new((**self).subst_spanned(tcx, substs, span))
145145
}
146146
}
147147

src/librustc/middle/trans/closure.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,11 @@ pub fn trans_expr_fn<'a>(
394394

395395
let cap_vars = ccx.maps.capture_map.borrow().get_copy(&id);
396396
let ClosureResult {llbox, cdata_ty, bcx} =
397-
build_closure(bcx, cap_vars.deref().as_slice(), sigil);
397+
build_closure(bcx, cap_vars.as_slice(), sigil);
398398
trans_closure(ccx, decl, body, llfn,
399399
bcx.fcx.param_substs, id,
400400
[], ty::ty_fn_ret(fty),
401-
|bcx| load_environment(bcx, cdata_ty, cap_vars.deref().as_slice(), sigil));
401+
|bcx| load_environment(bcx, cdata_ty, cap_vars.as_slice(), sigil));
402402
fill_fn_pair(bcx, dest_addr, llfn, llbox);
403403

404404
bcx

0 commit comments

Comments
 (0)