Skip to content

Commit

Permalink
Use Cow<str> instead of &str in Crop deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitrySamoylov committed May 28, 2021
1 parent ad003ca commit 609fc18
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pipeline/src/node_properties/transform_properties.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use std::str::FromStr;
use std::{borrow::Cow, str::FromStr};

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum FlipDirection {
Expand Down Expand Up @@ -60,9 +60,9 @@ impl<'de> Deserialize<'de> for Crop {
where
D: serde::de::Deserializer<'de>,
{
let s = <&str>::deserialize(deserializer)?;
let s = <Cow<str>>::deserialize(deserializer)?;

Crop::from_str(s).map_err(serde::de::Error::custom)
Crop::from_str(&s).map_err(serde::de::Error::custom)
}
}

Expand Down

0 comments on commit 609fc18

Please sign in to comment.