@@ -1530,25 +1530,23 @@ fn unique_build_targets(
15301530}
15311531
15321532#[ derive( Debug , Deserialize , Serialize , Clone ) ]
1533+ #[ serde( rename_all = "kebab-case" ) ]
15331534pub struct TomlWorkspace {
15341535 members : Option < Vec < String > > ,
1535- #[ serde( rename = "default-members" ) ]
1536- default_members : Option < Vec < String > > ,
15371536 exclude : Option < Vec < String > > ,
1537+ default_members : Option < Vec < String > > ,
15381538 resolver : Option < String > ,
1539+ metadata : Option < toml:: Value > ,
15391540
15401541 // Properties that can be inherited by members.
15411542 package : Option < InheritableFields > ,
15421543 dependencies : Option < BTreeMap < String , TomlDependency > > ,
15431544 lints : Option < TomlLints > ,
1544-
1545- // Note that this field must come last due to the way toml serialization
1546- // works which requires tables to be emitted after all values.
1547- metadata : Option < toml:: Value > ,
15481545}
15491546
15501547/// A group of fields that are inheritable by members of the workspace
15511548#[ derive( Clone , Debug , Default , Deserialize , Serialize ) ]
1549+ #[ serde( rename_all = "kebab-case" ) ]
15521550pub struct InheritableFields {
15531551 // We use skip here since it will never be present when deserializing
15541552 // and we don't want it present when serializing
@@ -1566,15 +1564,13 @@ pub struct InheritableFields {
15661564 keywords : Option < Vec < String > > ,
15671565 categories : Option < Vec < String > > ,
15681566 license : Option < String > ,
1569- #[ serde( rename = "license-file" ) ]
15701567 license_file : Option < String > ,
15711568 repository : Option < String > ,
15721569 publish : Option < VecStringOrBool > ,
15731570 edition : Option < String > ,
15741571 badges : Option < BTreeMap < String , BTreeMap < String , String > > > ,
15751572 exclude : Option < Vec < String > > ,
15761573 include : Option < Vec < String > > ,
1577- #[ serde( rename = "rust-version" ) ]
15781574 rust_version : Option < RustVersion > ,
15791575 // We use skip here since it will never be present when deserializing
15801576 // and we don't want it present when serializing
@@ -1710,13 +1706,11 @@ pub struct TomlPackage {
17101706 repository : Option < MaybeWorkspaceString > ,
17111707 resolver : Option < String > ,
17121708
1713- // Provide a helpful error message for a common user error.
1709+ metadata : Option < toml:: Value > ,
1710+
1711+ /// Provide a helpful error message for a common user error.
17141712 #[ serde( rename = "cargo-features" , skip_serializing) ]
17151713 _invalid_cargo_features : Option < InvalidCargoFeatures > ,
1716-
1717- // Note that this field must come last due to the way toml serialization
1718- // works which requires tables to be emitted after all values.
1719- metadata : Option < toml:: Value > ,
17201714}
17211715
17221716impl TomlPackage {
@@ -2034,6 +2028,7 @@ impl<'de> de::Deserialize<'de> for MaybeWorkspaceBtreeMap {
20342028}
20352029
20362030#[ derive( Deserialize , Serialize , Copy , Clone , Debug ) ]
2031+ #[ serde( rename_all = "kebab-case" ) ]
20372032pub struct TomlWorkspaceField {
20382033 #[ serde( deserialize_with = "bool_no_false" ) ]
20392034 workspace : bool ,
@@ -2064,7 +2059,7 @@ impl MaybeWorkspaceDependency {
20642059 fn unused_keys ( & self ) -> Vec < String > {
20652060 match self {
20662061 MaybeWorkspaceDependency :: Defined ( d) => d. unused_keys ( ) ,
2067- MaybeWorkspaceDependency :: Workspace ( w) => w. other . keys ( ) . cloned ( ) . collect ( ) ,
2062+ MaybeWorkspaceDependency :: Workspace ( w) => w. unused_keys . keys ( ) . cloned ( ) . collect ( ) ,
20682063 }
20692064 }
20702065}
@@ -2101,10 +2096,11 @@ pub struct TomlWorkspaceDependency {
21012096 default_features2 : Option < bool > ,
21022097 optional : Option < bool > ,
21032098 public : Option < bool > ,
2099+
21042100 /// This is here to provide a way to see the "unused manifest keys" when deserializing
21052101 #[ serde( skip_serializing) ]
21062102 #[ serde( flatten) ]
2107- other : BTreeMap < String , toml:: Value > ,
2103+ unused_keys : BTreeMap < String , toml:: Value > ,
21082104}
21092105
21102106impl TomlWorkspaceDependency {
@@ -2212,7 +2208,7 @@ impl TomlDependency {
22122208 fn unused_keys ( & self ) -> Vec < String > {
22132209 match self {
22142210 TomlDependency :: Simple ( _) => vec ! [ ] ,
2215- TomlDependency :: Detailed ( detailed) => detailed. other . keys ( ) . cloned ( ) . collect ( ) ,
2211+ TomlDependency :: Detailed ( detailed) => detailed. unused_keys . keys ( ) . cloned ( ) . collect ( ) ,
22162212 }
22172213 }
22182214}
@@ -2326,10 +2322,11 @@ pub struct DetailedTomlDependency<P: Clone = String> {
23262322 lib : Option < bool > ,
23272323 /// A platform name, like `x86_64-apple-darwin`
23282324 target : Option < String > ,
2325+
23292326 /// This is here to provide a way to see the "unused manifest keys" when deserializing
23302327 #[ serde( skip_serializing) ]
23312328 #[ serde( flatten) ]
2332- other : BTreeMap < String , toml:: Value > ,
2329+ unused_keys : BTreeMap < String , toml:: Value > ,
23332330}
23342331
23352332impl DetailedTomlDependency {
@@ -2635,7 +2632,7 @@ impl<P: Clone> Default for DetailedTomlDependency<P> {
26352632 artifact : Default :: default ( ) ,
26362633 lib : Default :: default ( ) ,
26372634 target : Default :: default ( ) ,
2638- other : Default :: default ( ) ,
2635+ unused_keys : Default :: default ( ) ,
26392636 }
26402637 }
26412638}
@@ -3383,20 +3380,20 @@ impl TomlTarget {
33833380
33843381/// Corresponds to a `target` entry, but `TomlTarget` is already used.
33853382#[ derive( Serialize , Deserialize , Debug , Clone ) ]
3383+ #[ serde( rename_all = "kebab-case" ) ]
33863384struct TomlPlatform {
33873385 dependencies : Option < BTreeMap < String , MaybeWorkspaceDependency > > ,
3388- #[ serde( rename = "build-dependencies" ) ]
33893386 build_dependencies : Option < BTreeMap < String , MaybeWorkspaceDependency > > ,
33903387 #[ serde( rename = "build_dependencies" ) ]
33913388 build_dependencies2 : Option < BTreeMap < String , MaybeWorkspaceDependency > > ,
3392- #[ serde( rename = "dev-dependencies" ) ]
33933389 dev_dependencies : Option < BTreeMap < String , MaybeWorkspaceDependency > > ,
33943390 #[ serde( rename = "dev_dependencies" ) ]
33953391 dev_dependencies2 : Option < BTreeMap < String , MaybeWorkspaceDependency > > ,
33963392}
33973393
33983394#[ derive( Deserialize , Serialize , Debug , Clone ) ]
33993395#[ serde( expecting = "a lints table" ) ]
3396+ #[ serde( rename_all = "kebab-case" ) ]
34003397pub struct MaybeWorkspaceLints {
34013398 #[ serde( skip_serializing_if = "is_false" ) ]
34023399 #[ serde( deserialize_with = "bool_no_false" , default ) ]
0 commit comments