remove a dead optimization

This commit is contained in:
Ralf Jung 2022-07-07 07:42:31 -04:00
parent 64dec227bd
commit 6b3986f44d

View File

@ -559,16 +559,9 @@ fn grant(
self.len() self.len()
}; };
// Put the new item there. As an optimization, deduplicate if it is equal to one of its new neighbors. // Put the new item there.
// `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); trace!("reborrow: adding item {:?}", new);
self.insert(new_idx, new); self.insert(new_idx, new);
}
Ok(()) Ok(())
} }
} }