From 6b3986f44d2e7fa388e80bb03abd6d26b1e573a4 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 7 Jul 2022 07:42:31 -0400 Subject: [PATCH] remove a dead optimization --- src/stacked_borrows.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/stacked_borrows.rs b/src/stacked_borrows.rs index 9969fbdbcd3..4e83c2c8aa9 100644 --- a/src/stacked_borrows.rs +++ b/src/stacked_borrows.rs @@ -559,16 +559,9 @@ fn grant( self.len() }; - // Put the new item there. As an optimization, deduplicate if it is equal to one of its new neighbors. - // `new_idx` might be 0 if we just cleared the entire stack. - if self.get(new_idx) == Some(new) || (new_idx > 0 && self.get(new_idx - 1).unwrap() == new) - { - // Optimization applies, done. - trace!("reborrow: avoiding adding redundant item {:?}", new); - } else { - trace!("reborrow: adding item {:?}", new); - self.insert(new_idx, new); - } + // Put the new item there. + trace!("reborrow: adding item {:?}", new); + self.insert(new_idx, new); Ok(()) } }