mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 14:10:03 +03:00
remove a dead optimization
This commit is contained in:
+3
-10
@@ -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(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user