]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_middle/src/mir/traversal.rs
Replace `&Vec<_>`s with `&[_]`s
[rust.git] / compiler / rustc_middle / src / mir / traversal.rs
index 8d831cc73b8a40409d5cb8b0deb3caa85c342e78..db64bcba3b111a11ed5ecbe0e7dbe0c54e96be8b 100644 (file)
@@ -180,7 +180,7 @@ fn traverse_successor(&mut self) {
         // two iterations yield `C` and finally `A` for a final traversal of [E, D, B, C, A]
         loop {
             let bb = if let Some(&mut (_, ref mut iter)) = self.visit_stack.last_mut() {
-                if let Some(&bb) = iter.next() {
+                if let Some(bb) = iter.next() {
                     bb
                 } else {
                     break;
@@ -310,7 +310,7 @@ pub fn reachable_as_bitset<'tcx>(body: &Body<'tcx>) -> BitSet<BasicBlock> {
 #[derive(Clone)]
 pub struct ReversePostorderIter<'a, 'tcx> {
     body: &'a Body<'tcx>,
-    blocks: &'a Vec<BasicBlock>,
+    blocks: &'a [BasicBlock],
     idx: usize,
 }
 
@@ -358,9 +358,9 @@ pub(super) fn invalidate(&mut self) {
         self.cache = OnceCell::new();
     }
 
-    /// Returns the &Vec<BasicBlocks> represents the postorder graph for this MIR.
+    /// Returns the `&[BasicBlocks]` represents the postorder graph for this MIR.
     #[inline]
-    pub(super) fn compute(&self, body: &Body<'_>) -> &Vec<BasicBlock> {
+    pub(super) fn compute(&self, body: &Body<'_>) -> &[BasicBlock] {
         self.cache.get_or_init(|| Postorder::new(body, START_BLOCK).map(|(bb, _)| bb).collect())
     }
 }