Skip to content

Commit

Permalink
Avoid some Place clones.
Browse files Browse the repository at this point in the history
This is a 0.5% speedup on ripgrep.
  • Loading branch information
nnethercote committed Aug 21, 2018
1 parent 3ac79c7 commit c0636ab
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/librustc_mir/borrow_check/mod.rs
Expand Up @@ -1080,7 +1080,10 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
}
}

if self
// Check is_empty() first because it's the common case, and doing that
// way we avoid the clone() call.
if !self.access_place_error_reported.is_empty() &&
self
.access_place_error_reported
.contains(&(place_span.0.clone(), place_span.1))
{
Expand Down

0 comments on commit c0636ab

Please sign in to comment.