Skip to content

Commit 178c4fb

Browse files
author
Cameron Zwarich
committed
Remove an unused return value
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.
1 parent 702ef1b commit 178c4fb

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/librustc/middle/borrowck/check_loans.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -825,14 +825,14 @@ impl<'a> CheckLoanCtxt<'a> {
825825
this: &CheckLoanCtxt,
826826
assignment_id: ast::NodeId,
827827
assignment_span: Span,
828-
assignee_cmt: mc::cmt) -> bool
828+
assignee_cmt: mc::cmt)
829829
{
830830
//! Check for assignments that violate the terms of an
831831
//! outstanding loan.
832832
833833
let loan_path = match opt_loan_path(&assignee_cmt) {
834834
Some(lp) => lp,
835-
None => { return true; /* no loan path, can't be any loans */ }
835+
None => { return; /* no loan path, can't be any loans */ }
836836
};
837837

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

855-
if !cont { return false }
855+
if !cont { return; }
856856

857857
// The previous code handled assignments to paths that
858858
// have been restricted. This covers paths that have been
@@ -899,21 +899,19 @@ impl<'a> CheckLoanCtxt<'a> {
899899
LpExtend(_, mc::McDeclared, _) |
900900
LpExtend(_, mc::McImmutable, _) |
901901
LpVar(_) => {
902-
return true;
902+
return;
903903
}
904904
};
905905

906906
// Check for a non-const loan of `loan_path`
907-
let cont = this.each_in_scope_loan(assignment_id, |loan| {
907+
this.each_in_scope_loan(assignment_id, |loan| {
908908
if loan.loan_path == loan_path {
909909
this.report_illegal_mutation(assignment_span, &*full_loan_path, loan);
910910
false
911911
} else {
912912
true
913913
}
914914
});
915-
916-
if !cont { return false }
917915
}
918916
}
919917
}

0 commit comments

Comments
 (0)