mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-22 13:38:43 +00:00
Optimize Deserialize
impl for CrateVersionSource
Use `<&str>::deserialize` instead of `String::deserialize` to avoid intermediate `String`. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
c2ce265afa
commit
9d9a31bef3
1 changed files with 2 additions and 1 deletions
|
@ -116,6 +116,7 @@ impl<'de> Deserialize<'de> for CrateVersionSource {
|
||||||
where
|
where
|
||||||
D: Deserializer<'de>,
|
D: Deserializer<'de>,
|
||||||
{
|
{
|
||||||
Self::from_str(&String::deserialize(deserializer)?).map_err(serde::de::Error::custom)
|
let s = <&str>::deserialize(deserializer)?;
|
||||||
|
Self::from_str(s).map_err(serde::de::Error::custom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue