Skip to content

Commit

Permalink
Remove an unused return value
Browse files Browse the repository at this point in the history
The only caller of check_for_assignment_to_restricted_or_frozen_location
isn't checking its return value, so we can remove it and simplify the
internal logic of the function.
  • Loading branch information
Cameron Zwarich committed Jun 16, 2014
1 parent 702ef1b commit 178c4fb
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/librustc/middle/borrowck/check_loans.rs
Expand Up @@ -825,14 +825,14 @@ impl<'a> CheckLoanCtxt<'a> {
this: &CheckLoanCtxt,
assignment_id: ast::NodeId,
assignment_span: Span,
assignee_cmt: mc::cmt) -> bool
assignee_cmt: mc::cmt)
{
//! Check for assignments that violate the terms of an
//! outstanding loan.

let loan_path = match opt_loan_path(&assignee_cmt) {
Some(lp) => lp,
None => { return true; /* no loan path, can't be any loans */ }
None => { return; /* no loan path, can't be any loans */ }
};

// Start by searching for an assignment to a *restricted*
Expand All @@ -852,7 +852,7 @@ impl<'a> CheckLoanCtxt<'a> {
false
});

if !cont { return false }
if !cont { return; }

// The previous code handled assignments to paths that
// have been restricted. This covers paths that have been
Expand Down Expand Up @@ -899,21 +899,19 @@ impl<'a> CheckLoanCtxt<'a> {
LpExtend(_, mc::McDeclared, _) |
LpExtend(_, mc::McImmutable, _) |
LpVar(_) => {
return true;
return;
}
};

// Check for a non-const loan of `loan_path`
let cont = this.each_in_scope_loan(assignment_id, |loan| {
this.each_in_scope_loan(assignment_id, |loan| {
if loan.loan_path == loan_path {
this.report_illegal_mutation(assignment_span, &*full_loan_path, loan);
false
} else {
true
}
});

if !cont { return false }
}
}
}
Expand Down

0 comments on commit 178c4fb

Please sign in to comment.