Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
It looks like this project hadn't had `cargo fmt` ran on it for a while.
This did this. This is a no-op change, just fixing whatever invalid
formatting was introduced before this commit.
  • Loading branch information
acatton committed Aug 26, 2024
1 parent 0512918 commit c4903d7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/with.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub mod singleton_map {
impl<D> SingletonMap<D> {
/// Create a new `SingletonMap`, wrapping either a `Serializer` or a `Deserializer`.
pub fn new(delegate: D) -> Self {
SingletonMap {delegate}
SingletonMap { delegate }
}
}

Expand Down Expand Up @@ -307,8 +307,7 @@ pub mod singleton_map {
where
V: ?Sized + Serialize,
{
self.delegate
.serialize_some(&SingletonMap::new(value))
self.delegate.serialize_some(&SingletonMap::new(value))
}

fn serialize_seq(self, len: Option<usize>) -> Result<Self::SerializeSeq, Self::Error> {
Expand Down
19 changes: 14 additions & 5 deletions tests/test_de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,10 +721,17 @@ fn test_enum_untagged() {
#[derive(Deserialize, PartialEq, Debug)]
#[serde(untagged)]
pub enum UntaggedEnum {
A { r#match: bool },
AB { r#match: String },
B { #[serde(rename = "if")] r#match: bool },
C(String)
A {
r#match: bool,
},
AB {
r#match: String,
},
B {
#[serde(rename = "if")]
r#match: bool,
},
C(String),
}

// A
Expand All @@ -735,7 +742,9 @@ fn test_enum_untagged() {
}
// AB
{
let expected = UntaggedEnum::AB { r#match: "T".to_owned() };
let expected = UntaggedEnum::AB {
r#match: "T".to_owned(),
};
let deserialized: UntaggedEnum = serde_yaml_ng::from_str("match: T").unwrap();
assert_eq!(expected, deserialized);
}
Expand Down

0 comments on commit c4903d7

Please sign in to comment.