refactor(toml): Move unique name validation out of resolving

This commit is contained in:
Ed Page 2024-04-04 14:27:23 -05:00
parent 943f9bc871
commit 36891bacfd

View File

@ -422,6 +422,8 @@ fn to_example_targets(
"autoexamples", "autoexamples",
)?; )?;
validate_unique_names(&targets, "example")?;
let mut result = Vec::new(); let mut result = Vec::new();
for toml in targets { for toml in targets {
let path = toml.path.clone().expect("previously resolved").0; let path = toml.path.clone().expect("previously resolved").0;
@ -468,6 +470,8 @@ fn to_test_targets(
"autotests", "autotests",
)?; )?;
validate_unique_names(&targets, "test")?;
let mut result = Vec::new(); let mut result = Vec::new();
for toml in targets { for toml in targets {
let path = toml.path.clone().expect("previously resolved").0; let path = toml.path.clone().expect("previously resolved").0;
@ -524,9 +528,10 @@ fn to_bench_targets(
"autobenches", "autobenches",
)? )?
}; };
warnings.append(&mut legacy_warnings); warnings.append(&mut legacy_warnings);
validate_unique_names(&targets, "bench")?;
let mut result = Vec::new(); let mut result = Vec::new();
for toml in targets { for toml in targets {
let path = toml.path.clone().expect("previously resolved").0; let path = toml.path.clone().expect("previously resolved").0;
@ -599,7 +604,6 @@ fn clean_targets_with_legacy_path(
validate_target_name(target, target_kind_human, target_kind, warnings)?; validate_target_name(target, target_kind_human, target_kind, warnings)?;
} }
validate_unique_names(&toml_targets, target_kind)?;
let mut result = Vec::new(); let mut result = Vec::new();
for mut target in toml_targets { for mut target in toml_targets {
let path = target_path( let path = target_path(