Skip to content

Commit

Permalink
refactor(toml): Be consistent for duplicate field names
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Nov 10, 2023
1 parent cbd466b commit f520d6c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/cargo/util/toml/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -956,10 +956,9 @@ pub struct TomlTarget {
pub doc: Option<bool>,
pub plugin: Option<bool>,
pub doc_scrape_examples: Option<bool>,
#[serde(rename = "proc-macro")]
pub proc_macro_raw: Option<bool>,
pub proc_macro: Option<bool>,
#[serde(rename = "proc_macro")]
pub proc_macro_raw2: Option<bool>,
pub proc_macro2: Option<bool>,
pub harness: Option<bool>,
pub required_features: Option<Vec<String>>,
pub edition: Option<String>,
Expand All @@ -971,7 +970,7 @@ impl TomlTarget {
}

pub fn proc_macro(&self) -> Option<bool> {
self.proc_macro_raw.or(self.proc_macro_raw2).or_else(|| {
self.proc_macro.or(self.proc_macro2).or_else(|| {
if let Some(types) = self.crate_types() {
if types.contains(&"proc-macro".to_string()) {
return Some(true);
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/util/toml/targets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ fn name_or_panic(target: &TomlTarget) -> &str {
}

fn validate_proc_macro(target: &TomlTarget, kind: &str, warnings: &mut Vec<String>) {
if target.proc_macro_raw.is_some() && target.proc_macro_raw2.is_some() {
if target.proc_macro.is_some() && target.proc_macro2.is_some() {
warn_on_deprecated(
"proc-macro",
name_or_panic(target),
Expand Down

0 comments on commit f520d6c

Please sign in to comment.