Skip to content

Commit fcb4781

Browse files
committed
librustc: Extract first_child and next_sibling from the borrow check
move data into accessors
1 parent f700cf3 commit fcb4781

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/librustc/middle/borrowck/move_data.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,12 @@ impl MoveData {
185185
self.paths[*index].first_move
186186
}
187187

188-
fn path<'a>(&'a self, index: MovePathIndex) -> &'a MovePath {
189-
//! Type safe indexing operator
190-
&self.paths[*index]
188+
fn path_first_child(&self, index: MovePathIndex) -> MovePathIndex {
189+
self.paths[*index].first_child
190+
}
191+
192+
fn path_next_sibling(&self, index: MovePathIndex) -> MovePathIndex {
193+
self.paths[*index].next_sibling
191194
}
192195

193196
fn mut_path<'a>(&'a mut self, index: MovePathIndex) -> &'a mut MovePath {
@@ -443,12 +446,12 @@ impl MoveData {
443446
return false;
444447
}
445448

446-
let mut p = self.path(index).first_child;
449+
let mut p = self.path_first_child(index);
447450
while p != InvalidMovePathIndex {
448451
if !self.each_extending_path(p, |x| f(x)) {
449452
return false;
450453
}
451-
p = self.path(p).next_sibling;
454+
p = self.path_next_sibling(p);
452455
}
453456

454457
return true;

0 commit comments

Comments
 (0)