tree-wide: replace serde_json::from_value(a_value.clone())
`&Value` itself implements `Deserializer` and can therefore be passed directly to `T::deserialize` without requiring an intermediate `clone()`. (This also enables optionally borrowing strings if the result has a short enough lifetime) Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
845baef61b
commit
38774184a9
@ -178,7 +178,7 @@ impl BackupManifest {
|
||||
pub fn fingerprint(&self) -> Result<Option<Fingerprint>, Error> {
|
||||
match &self.unprotected["key-fingerprint"] {
|
||||
Value::Null => Ok(None),
|
||||
value => Ok(Some(serde_json::from_value(value.clone())?))
|
||||
value => Ok(Some(Deserialize::deserialize(value)?))
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ impl BackupManifest {
|
||||
|
||||
let fingerprint = &json["unprotected"]["key-fingerprint"];
|
||||
if fingerprint != &Value::Null {
|
||||
let fingerprint = serde_json::from_value(fingerprint.clone())?;
|
||||
let fingerprint = Fingerprint::deserialize(fingerprint)?;
|
||||
let config_fp = Fingerprint::new(crypt_config.fingerprint());
|
||||
if config_fp != fingerprint {
|
||||
bail!(
|
||||
|
Reference in New Issue
Block a user