Skip to content

Commit 8c0e1ce

Browse files
author
Cameron Zwarich
committed
Make check_for_move_of_borrowed_path take an &LoanPath rather than an &Rc<LoanPath>
It doesn't actually need the Rc, and it reduces the net number of pointer manipulations.
1 parent d2d8fa2 commit 8c0e1ce

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustc/middle/borrowck/check_loans.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ impl<'a> CheckLoanCtxt<'a> {
454454
}
455455
Some(move_kind) => {
456456
self.check_for_move_of_borrowed_path(id, span,
457-
&lp, move_kind);
457+
&*lp, move_kind);
458458
if move_kind == move_data::Captured {
459459
MovedInCapture
460460
} else {
@@ -474,20 +474,20 @@ impl<'a> CheckLoanCtxt<'a> {
474474
fn check_for_move_of_borrowed_path(&self,
475475
id: ast::NodeId,
476476
span: Span,
477-
move_path: &Rc<LoanPath>,
477+
move_path: &LoanPath,
478478
move_kind: move_data::MoveKind) {
479-
match self.analyze_move_out_from(id, &**move_path) {
479+
match self.analyze_move_out_from(id, move_path) {
480480
MoveOk => { }
481481
MoveWhileBorrowed(loan_path, loan_span) => {
482482
let err_message = match move_kind {
483483
move_data::Captured =>
484484
format!("cannot move `{}` into closure because it is borrowed",
485-
self.bccx.loan_path_to_str(&**move_path).as_slice()),
485+
self.bccx.loan_path_to_str(move_path).as_slice()),
486486
move_data::Declared |
487487
move_data::MoveExpr |
488488
move_data::MovePat =>
489489
format!("cannot move out of `{}` because it is borrowed",
490-
self.bccx.loan_path_to_str(&**move_path).as_slice())
490+
self.bccx.loan_path_to_str(move_path).as_slice())
491491
};
492492

493493
self.bccx.span_err(span, err_message.as_slice());

0 commit comments

Comments
 (0)