mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 07:49:11 +03:00
revisionstore: remove into_boxed_slice usage
Summary: I learned that Box::from() can be used to copy a slice into a box, so let's replace my previous to_vec().into_boxed_slice() with this. Reviewed By: quark-zju Differential Revision: D9350961 fbshipit-source-id: 94053b82cd64923dfabc9acf3a9dab6daca20cf3
This commit is contained in:
parent
37c830f836
commit
94c6ad00ef
@ -402,7 +402,7 @@ impl<'a> Iterator for DataPackIterator<'a> {
|
||||
Some(match entry {
|
||||
Ok(ref e) => {
|
||||
self.offset = e.next_offset;
|
||||
Ok(Key::new(e.filename.to_vec().into_boxed_slice(), e.node))
|
||||
Ok(Key::new(Box::from(e.filename), e.node))
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
})
|
||||
|
@ -45,7 +45,7 @@ impl MutableHistoryPack {
|
||||
// To get the inner map, then insert our new NodeInfo. Unfortunately it requires
|
||||
// key.name().clone() though. So we have to do it the long way to avoid the allocation.
|
||||
let entries = self.mem_index
|
||||
.entry(key.name().to_vec().into_boxed_slice())
|
||||
.entry(Box::from(key.name()))
|
||||
.or_insert_with(|| HashMap::new());
|
||||
entries.insert(key.clone(), info.clone());
|
||||
Ok(())
|
||||
|
Loading…
Reference in New Issue
Block a user