From 2c61a70bb29784b3002623aefae51ccab0e39519 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 10 Nov 2023 16:01:36 -0600 Subject: [PATCH] refactor(toml): Consistently lead with 'Toml' prefix --- src/cargo/util/toml/mod.rs | 10 +++++----- src/cargo/util/toml/schema.rs | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index b634ff654ad..86926c02c0a 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -356,7 +356,7 @@ impl schema::TomlManifest { Ok(d) } schema::MaybeWorkspace::Defined(schema::TomlDependency::Simple(s)) => { - Ok(schema::DetailedTomlDependency { + Ok(schema::TomlDetailedDependency { version: Some(s.clone()), ..Default::default() }) @@ -1633,7 +1633,7 @@ impl schema::TomlWorkspaceDependency { default_features_msg(name, None, cx); } if self.optional.is_some() || self.features.is_some() || self.public.is_some() { - schema::TomlDependency::Detailed(schema::DetailedTomlDependency { + schema::TomlDependency::Detailed(schema::TomlDetailedDependency { version: Some(s), optional: self.optional, features: self.features.clone(), @@ -1726,7 +1726,7 @@ impl schema::TomlDependency

{ kind: Option, ) -> CargoResult { match *self { - schema::TomlDependency::Simple(ref version) => schema::DetailedTomlDependency::

{ + schema::TomlDependency::Simple(ref version) => schema::TomlDetailedDependency::

{ version: Some(version.clone()), ..Default::default() } @@ -1736,7 +1736,7 @@ impl schema::TomlDependency

{ } } -impl schema::DetailedTomlDependency { +impl schema::TomlDetailedDependency { fn add_features(&mut self, features: Option>) { self.features = match (self.features.clone(), features.clone()) { (Some(dep_feat), Some(inherit_feat)) => Some( @@ -1773,7 +1773,7 @@ impl schema::DetailedTomlDependency { } } -impl schema::DetailedTomlDependency

{ +impl schema::TomlDetailedDependency

{ fn to_dependency( &self, name_in_toml: &str, diff --git a/src/cargo/util/toml/schema.rs b/src/cargo/util/toml/schema.rs index 7a85b3edf3f..694babcfc5c 100644 --- a/src/cargo/util/toml/schema.rs +++ b/src/cargo/util/toml/schema.rs @@ -500,7 +500,7 @@ pub enum TomlDependency { /// The simple format is equivalent to a detailed dependency /// specifying only a version, eg. /// `package = { version = "" }` - Detailed(DetailedTomlDependency

), + Detailed(TomlDetailedDependency

), } impl TomlDependency { @@ -544,7 +544,7 @@ impl<'de, P: Deserialize<'de> + Clone> de::Deserialize<'de> for TomlDependency

{ +pub struct TomlDetailedDependency { pub version: Option, pub registry: Option, /// The URL of the `registry` field. @@ -582,14 +582,14 @@ pub struct DetailedTomlDependency { pub _unused_keys: BTreeMap, } -impl DetailedTomlDependency

{ +impl TomlDetailedDependency

{ pub fn default_features(&self) -> Option { self.default_features.or(self.default_features2) } } // Explicit implementation so we avoid pulling in P: Default -impl Default for DetailedTomlDependency

{ +impl Default for TomlDetailedDependency

{ fn default() -> Self { Self { version: Default::default(),