diff options
Diffstat (limited to 'tvix/serde')
-rw-r--r-- | tvix/serde/src/de.rs | 3 | ||||
-rw-r--r-- | tvix/serde/src/de_tests.rs | 22 | ||||
-rw-r--r-- | tvix/serde/src/error.rs | 2 |
3 files changed, 13 insertions, 14 deletions
diff --git a/tvix/serde/src/de.rs b/tvix/serde/src/de.rs index fddda65907a4..59a72b7417f9 100644 --- a/tvix/serde/src/de.rs +++ b/tvix/serde/src/de.rs @@ -304,8 +304,7 @@ impl<'de> de::Deserializer<'de> for NixDeserializer { V: de::Visitor<'de>, { if let Value::List(list) = self.value { - let mut seq = - SeqDeserializer::new(list.into_iter().map(|value| NixDeserializer::new(value))); + let mut seq = SeqDeserializer::new(list.into_iter().map(NixDeserializer::new)); let result = visitor.visit_seq(&mut seq)?; seq.end()?; return Ok(result); diff --git a/tvix/serde/src/de_tests.rs b/tvix/serde/src/de_tests.rs index 9764653caa86..807d953c77fa 100644 --- a/tvix/serde/src/de_tests.rs +++ b/tvix/serde/src/de_tests.rs @@ -161,24 +161,24 @@ fn deserialize_enum_all() { #[derive(Debug, Deserialize, PartialEq)] #[serde(rename_all = "snake_case")] enum TestEnum { - UnitVariant, - TupleVariant(String, String), - StructVariant { name: String, age: usize }, + Unit, + Tuple(String, String), + Struct { name: String, age: usize }, } let result: Vec<TestEnum> = from_str( r#" let - mkTuple = country: drink: { tuple_variant = [ country drink ]; }; + mkTuple = country: drink: { tuple = [ country drink ]; }; in [ (mkTuple "UK" "cask ale") - "unit_variant" + "unit" { - struct_variant.name = "Slartibartfast"; - struct_variant.age = 42; + struct.name = "Slartibartfast"; + struct.age = 42; } (mkTuple "Russia" "квас") @@ -188,13 +188,13 @@ fn deserialize_enum_all() { .expect("should deserialize"); let expected = vec![ - TestEnum::TupleVariant("UK".into(), "cask ale".into()), - TestEnum::UnitVariant, - TestEnum::StructVariant { + TestEnum::Tuple("UK".into(), "cask ale".into()), + TestEnum::Unit, + TestEnum::Struct { name: "Slartibartfast".into(), age: 42, }, - TestEnum::TupleVariant("Russia".into(), "квас".into()), + TestEnum::Tuple("Russia".into(), "квас".into()), ]; assert_eq!(result, expected); diff --git a/tvix/serde/src/error.rs b/tvix/serde/src/error.rs index f206b830e95f..c1d2258bbfe4 100644 --- a/tvix/serde/src/error.rs +++ b/tvix/serde/src/error.rs @@ -64,7 +64,7 @@ impl Display for Error { )?; for err in errors { - writeln!(f, "{}", err.fancy_format_str(&source))?; + writeln!(f, "{}", err.fancy_format_str(source))?; } Ok(()) |