Reimplement StoreId::to_str() to remove unwrap()
This commit is contained in:
parent
52367edc83
commit
3d572dda0f
1 changed files with 8 additions and 10 deletions
|
@ -95,13 +95,11 @@ impl StoreId {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_str(&self) -> Result<String> {
|
pub fn to_str(&self) -> Result<String> {
|
||||||
if self.base.is_some() {
|
self.base
|
||||||
let mut base = self.base.as_ref().cloned().unwrap();
|
.as_ref()
|
||||||
base.push(self.id.clone());
|
.cloned()
|
||||||
base
|
.map(|mut base| { base.push(self.id.clone()); base })
|
||||||
} else {
|
.unwrap_or_else(|| self.id.clone())
|
||||||
self.id.clone()
|
|
||||||
}
|
|
||||||
.to_str()
|
.to_str()
|
||||||
.map(String::from)
|
.map(String::from)
|
||||||
.ok_or(SEK::StoreIdHandlingError.into_error())
|
.ok_or(SEK::StoreIdHandlingError.into_error())
|
||||||
|
|
Loading…
Reference in a new issue