Auto merge of #2342 - RalfJung:dead-opt, r=RalfJung
remove a dead optimization This became dead code when I removed "Untagged".
This commit is contained in:
commit
e7025223db
@ -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.
|
trace!("reborrow: adding item {:?}", new);
|
||||||
if self.get(new_idx) == Some(new) || (new_idx > 0 && self.get(new_idx - 1).unwrap() == new)
|
self.insert(new_idx, new);
|
||||||
{
|
|
||||||
// Optimization applies, done.
|
|
||||||
trace!("reborrow: avoiding adding redundant item {:?}", new);
|
|
||||||
} else {
|
|
||||||
trace!("reborrow: adding item {:?}", new);
|
|
||||||
self.insert(new_idx, new);
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user