match loan_path.kind {
LpVar(_) | LpUpvar(_) => None,
LpExtend(ref lp_base, _, LpDeref(mc::Unique)) => {
- match helper(&**lp_base) {
+ match helper(&lp_base) {
v @ Some(_) => v,
- None => Some(&**lp_base)
+ None => Some(&lp_base)
}
}
LpDowncast(ref lp_base, _) |
- LpExtend(ref lp_base, _, _) => helper(&**lp_base)
+ LpExtend(ref lp_base, _, _) => helper(&lp_base)
}
}
}
}
LpDowncast(ref lp_base, _) |
LpExtend(ref lp_base, _, _) => {
- loan_path = &**lp_base;
+ loan_path = &lp_base;
}
}
// borrow prevents subsequent moves, borrows, or modification of `x` until the
// borrow ends
- let common = new_loan.loan_path.common(&*old_loan.loan_path);
+ let common = new_loan.loan_path.common(&old_loan.loan_path);
let (nl, ol, new_loan_msg, old_loan_msg) =
- if new_loan.loan_path.has_fork(&*old_loan.loan_path) && common.is_some() {
+ if new_loan.loan_path.has_fork(&old_loan.loan_path) && common.is_some() {
let nl = self.bccx.loan_path_to_string(&common.unwrap());
let ol = nl.clone();
let new_loan_msg = format!(" (here through borrowing `{}`)",
self.bccx.loan_path_to_string(
- &*new_loan.loan_path));
+ &new_loan.loan_path));
let old_loan_msg = format!(" (through borrowing `{}`)",
self.bccx.loan_path_to_string(
- &*old_loan.loan_path));
+ &old_loan.loan_path));
(nl, ol, new_loan_msg, old_loan_msg)
} else {
- (self.bccx.loan_path_to_string(&*new_loan.loan_path),
- self.bccx.loan_path_to_string(&*old_loan.loan_path),
+ (self.bccx.loan_path_to_string(&new_loan.loan_path),
+ self.bccx.loan_path_to_string(&old_loan.loan_path),
String::new(), String::new())
};
Some(lp) => {
let moved_value_use_kind = match mode {
euv::Copy => {
- self.check_for_copy_of_frozen_path(id, span, &*lp);
+ self.check_for_copy_of_frozen_path(id, span, &lp);
MovedInUse
}
euv::Move(_) => {
}
Some(move_kind) => {
self.check_for_move_of_borrowed_path(id, span,
- &*lp, move_kind);
+ &lp, move_kind);
if move_kind == move_data::Captured {
MovedInCapture
} else {
&self.bccx.loan_path_to_string(copy_path))
.span_note(loan_span,
&format!("borrow of `{}` occurs here",
- &self.bccx.loan_path_to_string(&*loan_path))
+ &self.bccx.loan_path_to_string(&loan_path))
)
.emit();
}
err.span_note(
loan_span,
&format!("borrow of `{}` occurs here",
- &self.bccx.loan_path_to_string(&*loan_path))
+ &self.bccx.loan_path_to_string(&loan_path))
);
err.emit();
}
self.bccx.report_use_of_moved_value(
span,
use_kind,
- &**lp,
+ &lp,
the_move,
moved_lp,
self.param_env);
self.bccx
.report_partial_reinitialization_of_uninitialized_structure(
span,
- &*loan_path);
+ &loan_path);
false
});
return;
// Check that we don't invalidate any outstanding loans
if let Some(loan_path) = opt_loan_path(&assignee_cmt) {
let scope = self.tcx().region_maps.node_extent(assignment_id);
- self.each_in_scope_loan_affecting_path(scope, &*loan_path, |loan| {
- self.report_illegal_mutation(assignment_span, &*loan_path, loan);
+ self.each_in_scope_loan_affecting_path(scope, &loan_path, |loan| {
+ self.report_illegal_mutation(assignment_span, &loan_path, loan);
false
});
}
} else {
self.bccx.report_reassigned_immutable_variable(
assignment_span,
- &*lp,
+ &lp,
assign);
}
false
let gen_scope = self.compute_gen_scope(borrow_scope, loan_scope);
debug!("gen_scope = {:?}", gen_scope);
- let kill_scope = self.compute_kill_scope(loan_scope, &*loan_path);
+ let kill_scope = self.compute_kill_scope(loan_scope, &loan_path);
debug!("kill_scope = {:?}", kill_scope);
if req_kind == ty::MutBorrow {
- self.mark_loan_path_as_mutated(&*loan_path);
+ self.mark_loan_path_as_mutated(&loan_path);
}
Loan {
LpDowncast(ref base, _) |
LpExtend(ref base, mc::McInherited, _) |
LpExtend(ref base, mc::McDeclared, _) => {
- self.mark_loan_path_as_mutated(&**base);
+ self.mark_loan_path_as_mutated(&base);
}
LpExtend(_, mc::McImmutable, _) => {
// Nothing to do.
if let hir::ExprAddrOf(mutbl, ref base) = ex.node {
let infcx = infer::new_infer_ctxt(self.bccx.tcx, &self.bccx.tcx.tables, None);
let mc = mc::MemCategorizationContext::new(&infcx);
- let base_cmt = mc.cat_expr(&**base).unwrap();
+ let base_cmt = mc.cat_expr(&base).unwrap();
let borrow_kind = ty::BorrowKind::from_mutbl(mutbl);
// Check that we don't allow borrows of unsafe static items.
if check_aliasability(self.bccx, ex.span,
fn visit_trait_item(&mut self, ti: &hir::TraitItem) {
if let hir::ConstTraitItem(_, Some(ref expr)) = ti.node {
- gather_loans::gather_loans_in_static_initializer(self, &*expr);
+ gather_loans::gather_loans_in_static_initializer(self, &expr);
}
intravisit::walk_trait_item(self, ti);
}
fn visit_impl_item(&mut self, ii: &hir::ImplItem) {
if let hir::ImplItemKind::Const(_, ref expr) = ii.node {
- gather_loans::gather_loans_in_static_initializer(self, &*expr);
+ gather_loans::gather_loans_in_static_initializer(self, &expr);
}
intravisit::walk_impl_item(self, ii);
}
match item.node {
hir::ItemStatic(_, _, ref ex) |
hir::ItemConst(_, ref ex) => {
- gather_loans::gather_loans_in_static_initializer(this, &**ex);
+ gather_loans::gather_loans_in_static_initializer(this, &ex);
}
_ => { }
}
let dataflow_data = build_borrowck_dataflow_data(&mut bccx,
fn_parts.kind,
- &*fn_parts.decl,
+ &fn_parts.decl,
cfg,
- &*fn_parts.body,
+ &fn_parts.body,
fn_parts.span,
fn_parts.id);
(&LpExtend(ref base, _, LpInterior(opt_variant_id, id)),
&LpExtend(ref base2, _, LpInterior(opt_variant_id2, id2))) =>
if id == id2 && opt_variant_id == opt_variant_id2 {
- base.has_fork(&**base2)
+ base.has_fork(&base2)
} else {
true
},
(&LpExtend(ref base, _, LpDeref(_)), _) => base.has_fork(other),
- (_, &LpExtend(ref base, _, LpDeref(_))) => self.has_fork(&**base),
+ (_, &LpExtend(ref base, _, LpDeref(_))) => self.has_fork(&base),
_ => false,
}
}
(&LpExtend(ref base, a, LpInterior(opt_variant_id, id)),
&LpExtend(ref base2, _, LpInterior(opt_variant_id2, id2))) => {
if id == id2 && opt_variant_id == opt_variant_id2 {
- base.common(&**base2).map(|x| {
+ base.common(&base2).map(|x| {
let xd = x.depth();
if base.depth() == xd && base2.depth() == xd {
assert_eq!(base.ty, base2.ty);
}
})
} else {
- base.common(&**base2)
+ base.common(&base2)
}
}
(&LpExtend(ref base, _, LpDeref(_)), _) => base.common(other),
- (_, &LpExtend(ref other, _, LpDeref(_))) => self.common(&**other),
+ (_, &LpExtend(ref other, _, LpDeref(_))) => self.common(&other),
(&LpVar(id), &LpVar(id2)) => {
if id == id2 {
assert_eq!(self.ty, other.ty);
.map
.find(the_move.id) {
Some(hir_map::NodeExpr(expr)) => {
- (self.tcx.expr_ty_adjusted(&*expr), expr.span)
+ (self.tcx.expr_ty_adjusted(&expr), expr.span)
}
r => {
self.tcx.sess.bug(&format!("MoveExpr({}) maps to \
.map
.find(the_move.id) {
Some(hir_map::NodeExpr(expr)) => {
- (self.tcx.expr_ty_adjusted(&*expr), expr.span)
+ (self.tcx.expr_ty_adjusted(&expr), expr.span)
}
r => {
self.tcx.sess.bug(&format!("Captured({}) maps to \
err_mutbl => {
let descr = match err.cmt.note {
mc::NoteClosureEnv(_) | mc::NoteUpvarRef(_) => {
- self.cmt_to_string(&*err.cmt)
+ self.cmt_to_string(&err.cmt)
}
_ => match opt_loan_path(&err.cmt) {
None => {
format!("{} {}",
err.cmt.mutbl.to_user_str(),
- self.cmt_to_string(&*err.cmt))
+ self.cmt_to_string(&err.cmt))
}
Some(lp) => {
format!("{} {} `{}`",
err.cmt.mutbl.to_user_str(),
- self.cmt_to_string(&*err.cmt),
- self.loan_path_to_string(&*lp))
+ self.cmt_to_string(&err.cmt),
+ self.loan_path_to_string(&lp))
}
}
};
let msg = match opt_loan_path(&err.cmt) {
None => "borrowed value".to_string(),
Some(lp) => {
- format!("`{}`", self.loan_path_to_string(&*lp))
+ format!("`{}`", self.loan_path_to_string(&lp))
}
};
format!("{} does not live long enough", msg)
err_borrowed_pointer_too_short(loan_scope, ptr_scope) => {
let descr = match opt_loan_path(&err.cmt) {
Some(lp) => {
- format!("`{}`", self.loan_path_to_string(&*lp))
+ format!("`{}`", self.loan_path_to_string(&lp))
}
- None => self.cmt_to_string(&*err.cmt),
+ None => self.cmt_to_string(&err.cmt),
};
self.tcx.note_and_explain_region(
db,
LpDowncast(ref lp_base, variant_def_id) => {
out.push('(');
- self.append_loan_path_to_string(&**lp_base, out);
+ self.append_loan_path_to_string(&lp_base, out);
out.push_str(DOWNCAST_PRINTED_OPERATOR);
out.push_str(&self.tcx.item_path_str(variant_def_id));
out.push(')');
LpExtend(ref lp_base, _, LpInterior(_, InteriorField(fname))) => {
- self.append_autoderefd_loan_path_to_string(&**lp_base, out);
+ self.append_autoderefd_loan_path_to_string(&lp_base, out);
match fname {
mc::NamedField(fname) => {
out.push('.');
}
LpExtend(ref lp_base, _, LpInterior(_, InteriorElement(..))) => {
- self.append_autoderefd_loan_path_to_string(&**lp_base, out);
+ self.append_autoderefd_loan_path_to_string(&lp_base, out);
out.push_str("[..]");
}
LpExtend(ref lp_base, _, LpDeref(_)) => {
out.push('*');
- self.append_loan_path_to_string(&**lp_base, out);
+ self.append_loan_path_to_string(&lp_base, out);
}
}
}
// For a path like `(*x).f` or `(*x)[3]`, autoderef
// rules would normally allow users to omit the `*x`.
// So just serialize such paths to `x.f` or x[3]` respectively.
- self.append_autoderefd_loan_path_to_string(&**lp_base, out)
+ self.append_autoderefd_loan_path_to_string(&lp_base, out)
}
LpDowncast(ref lp_base, variant_def_id) => {
out.push('(');
- self.append_autoderefd_loan_path_to_string(&**lp_base, out);
+ self.append_autoderefd_loan_path_to_string(&lp_base, out);
out.push(':');
out.push_str(&self.tcx.item_path_str(variant_def_id));
out.push(')');