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
@ -22,6 +22,7 @@ percent-encoding = "2.1"
|
||||
pin-project-lite = "0.2"
|
||||
regex = "1.5"
|
||||
rustyline = "7"
|
||||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
tokio = { version = "1.6", features = [ "fs", "signal" ] }
|
||||
tokio-stream = "0.1.0"
|
||||
|
@ -131,7 +131,7 @@ fn do_crypto_parameters(param: &Value, keep_keyfd_open: bool) -> Result<CryptoPa
|
||||
};
|
||||
|
||||
let mode: Option<CryptMode> = match param.get("crypt-mode") {
|
||||
Some(mode) => Some(serde_json::from_value(mode.clone())?),
|
||||
Some(mode) => Some(serde::Deserialize::deserialize(mode)?),
|
||||
None => None,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user