@@ -35,11 +35,13 @@ use crate::schema::TomlValueWrapper;
3535#[ serde( rename_all = "kebab-case" ) ]
3636#[ cfg_attr( feature = "unstable-schema" , derive( schemars:: JsonSchema ) ) ]
3737pub struct TomlManifest {
38- // when adding new fields, be sure to check whether `requires_package` should disallow them
3938 pub cargo_features : Option < Vec < String > > ,
39+
40+ // Update `requires_package` when adding new package-specific fields
4041 pub package : Option < Box < TomlPackage > > ,
4142 pub project : Option < Box < TomlPackage > > ,
42- pub profile : Option < TomlProfiles > ,
43+ pub badges : Option < BTreeMap < String , BTreeMap < String , String > > > ,
44+ pub features : Option < BTreeMap < FeatureName , Vec < String > > > ,
4345 pub lib : Option < TomlLibTarget > ,
4446 pub bin : Option < Vec < TomlBinTarget > > ,
4547 pub example : Option < Vec < TomlExampleTarget > > ,
@@ -52,14 +54,14 @@ pub struct TomlManifest {
5254 pub build_dependencies : Option < BTreeMap < PackageName , InheritableDependency > > ,
5355 #[ serde( rename = "build_dependencies" ) ]
5456 pub build_dependencies2 : Option < BTreeMap < PackageName , InheritableDependency > > ,
55- pub features : Option < BTreeMap < FeatureName , Vec < String > > > ,
5657 pub target : Option < BTreeMap < String , TomlPlatform > > ,
57- pub replace : Option < BTreeMap < String , TomlDependency > > ,
58- pub patch : Option < BTreeMap < String , BTreeMap < PackageName , TomlDependency > > > ,
59- pub workspace : Option < TomlWorkspace > ,
60- pub badges : Option < BTreeMap < String , BTreeMap < String , String > > > ,
6158 pub lints : Option < InheritableLints > ,
6259
60+ pub workspace : Option < TomlWorkspace > ,
61+ pub profile : Option < TomlProfiles > ,
62+ pub patch : Option < BTreeMap < String , BTreeMap < PackageName , TomlDependency > > > ,
63+ pub replace : Option < BTreeMap < String , TomlDependency > > ,
64+
6365 /// Report unused keys (see also nested `_unused_keys`)
6466 /// Note: this is populated by the caller, rather than automatically
6567 #[ serde( skip) ]
@@ -69,6 +71,8 @@ pub struct TomlManifest {
6971impl TomlManifest {
7072 pub fn requires_package ( & self ) -> impl Iterator < Item = & ' static str > {
7173 [
74+ self . badges . as_ref ( ) . map ( |_| "badges" ) ,
75+ self . features . as_ref ( ) . map ( |_| "features" ) ,
7276 self . lib . as_ref ( ) . map ( |_| "lib" ) ,
7377 self . bin . as_ref ( ) . map ( |_| "bin" ) ,
7478 self . example . as_ref ( ) . map ( |_| "example" ) ,
@@ -79,9 +83,7 @@ impl TomlManifest {
7983 self . build_dependencies ( )
8084 . as_ref ( )
8185 . map ( |_| "build-dependencies" ) ,
82- self . features . as_ref ( ) . map ( |_| "features" ) ,
8386 self . target . as_ref ( ) . map ( |_| "target" ) ,
84- self . badges . as_ref ( ) . map ( |_| "badges" ) ,
8587 self . lints . as_ref ( ) . map ( |_| "lints" ) ,
8688 ]
8789 . into_iter ( )
0 commit comments