remove "unsafe unwraps"
This commit is contained in:
parent
c0e1f42533
commit
001fad3145
1 changed files with 4 additions and 2 deletions
|
@ -78,12 +78,14 @@ impl EntryValue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// unsafe unwraps!
|
|
||||||
impl std::fmt::Display for EntryValue {
|
impl std::fmt::Display for EntryValue {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
let (entry_type, entry_value) = match self {
|
let (entry_type, entry_value) = match self {
|
||||||
EntryValue::Address(address) => ("ADDRESS", address.to_string()),
|
EntryValue::Address(address) => ("ADDRESS", address.to_string()),
|
||||||
EntryValue::Value(value) => ("VALUE", serde_json::to_string(value).unwrap()),
|
EntryValue::Value(value) => (
|
||||||
|
"VALUE",
|
||||||
|
serde_json::to_string(value).unwrap_or_else(|_| String::from("?!?!?!")),
|
||||||
|
),
|
||||||
EntryValue::Invalid => ("INVALID", "INVALID".to_string()),
|
EntryValue::Invalid => ("INVALID", "INVALID".to_string()),
|
||||||
};
|
};
|
||||||
write!(f, "{}: {}", entry_type, entry_value)
|
write!(f, "{}: {}", entry_type, entry_value)
|
||||||
|
|
Loading…
Reference in a new issue