Skip to content

Commit

Permalink
Rename for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkuu committed Feb 19, 2020
1 parent 06f0ab0 commit 1c5c054
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions clippy_lints/src/redundant_clone.rs
Expand Up @@ -452,7 +452,7 @@ impl<'a, 'tcx> PossibleBorrowerVisitor<'a, 'tcx> {
self,
cx: &LateContext<'a, 'tcx>,
maybe_live: DataflowResults<'tcx, MaybeStorageLive<'a, 'tcx>>,
) -> PossibleBorrower<'a, 'tcx> {
) -> PossibleBorrowerMap<'a, 'tcx> {
let mut map = FxHashMap::default();
for row in (1..self.body.local_decls.len()).map(mir::Local::from_usize) {
if is_copy(cx, self.body.local_decls[row].ty) {
Expand All @@ -475,7 +475,7 @@ impl<'a, 'tcx> PossibleBorrowerVisitor<'a, 'tcx> {
}

let bs = BitSet::new_empty(self.body.local_decls.len());
PossibleBorrower {
PossibleBorrowerMap {
map,
maybe_live: DataflowResultsCursor::new(maybe_live, self.body),
bitset: (bs.clone(), bs),
Expand Down Expand Up @@ -557,15 +557,15 @@ fn rvalue_locals(rvalue: &mir::Rvalue<'_>, mut visit: impl FnMut(mir::Local)) {
}

/// Result of `PossibleBorrowerVisitor`.
struct PossibleBorrower<'a, 'tcx> {
struct PossibleBorrowerMap<'a, 'tcx> {
/// Mapping `Local -> its possible borrowers`
map: FxHashMap<mir::Local, HybridBitSet<mir::Local>>,
maybe_live: DataflowResultsCursor<'a, 'tcx, MaybeStorageLive<'a, 'tcx>>,
// Caches to avoid allocation of `BitSet` on every query
bitset: (BitSet<mir::Local>, BitSet<mir::Local>),
}

impl PossibleBorrower<'_, '_> {
impl PossibleBorrowerMap<'_, '_> {
/// Returns true if the set of borrowers of `borrowed` living at `at` matches with `borrowers`.
fn only_borrowers(&mut self, borrowers: &[mir::Local], borrowed: mir::Local, at: mir::Location) -> bool {
self.maybe_live.seek(at);
Expand Down

0 comments on commit 1c5c054

Please sign in to comment.