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
@ -230,7 +230,7 @@ async fn list(snapshot: String, path: String, base64: bool, param: Value) -> Res
|
||||
keyfile,
|
||||
};
|
||||
let driver: Option<BlockDriverType> = match param.get("driver") {
|
||||
Some(drv) => Some(serde_json::from_value(drv.clone())?),
|
||||
Some(drv) => Some(serde::Deserialize::deserialize(drv)?),
|
||||
None => None,
|
||||
};
|
||||
data_list(driver, details, file, path).await
|
||||
@ -382,7 +382,7 @@ async fn extract(
|
||||
keyfile,
|
||||
};
|
||||
let driver: Option<BlockDriverType> = match param.get("driver") {
|
||||
Some(drv) => Some(serde_json::from_value(drv.clone())?),
|
||||
Some(drv) => Some(serde::Deserialize::deserialize(drv)?),
|
||||
None => None,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user