Do not check whether old or new id exists/does not exist
This commit is contained in:
parent
4f83b22b98
commit
f16c09a981
1 changed files with 12 additions and 16 deletions
|
@ -650,7 +650,6 @@ impl Store {
|
|||
|
||||
/// Move an entry without loading
|
||||
pub fn move_by_id(&self, old_id: StoreId, new_id: StoreId) -> Result<()> {
|
||||
|
||||
let new_id = new_id.with_base(self.path().clone());
|
||||
let old_id = old_id.with_base(self.path().clone());
|
||||
|
||||
|
@ -671,11 +670,9 @@ impl Store {
|
|||
return Err(SEK::EntryAlreadyExists.into_error());
|
||||
}
|
||||
|
||||
if !hsmap.contains_key(&old_id) {
|
||||
return Err(SE::new(SEK::EntryAlreadyBorrowed, None));
|
||||
} else {
|
||||
let old_id_pb = try!(old_id.clone().with_base(self.path().clone()).into_pathbuf());
|
||||
let new_id_pb = try!(new_id.clone().with_base(self.path().clone()).into_pathbuf());
|
||||
|
||||
match FileAbstraction::rename(&old_id_pb, &new_id_pb) {
|
||||
Err(e) => return Err(SEK::EntryRenameError.into_error_with_cause(Box::new(e))),
|
||||
Ok(_) => {
|
||||
|
@ -688,7 +685,6 @@ impl Store {
|
|||
.and_then(|entry| hsmap.insert(new_id.clone(), entry)).is_none())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue