Skip to content

Commit cdae596

Browse files
committed
refactor(toml): Consistently document motivation for validation order
1 parent fe0819e commit cdae596

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cargo/util/toml/targets.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ pub fn resolve_lib(
141141
let Some(mut lib) = lib else { return Ok(None) };
142142
lib.name
143143
.get_or_insert_with(|| package_name.replace("-", "_"));
144+
144145
// Check early to improve error messages
145146
validate_lib_name(&lib, warnings)?;
146147

147-
// Checking the original lib
148148
validate_proc_macro(&lib, "library", edition, warnings)?;
149149
validate_crate_types(&lib, "library", edition, warnings)?;
150150

@@ -276,7 +276,9 @@ pub fn resolve_bins(
276276
);
277277

278278
for bin in &mut bins {
279+
// Check early to improve error messages
279280
validate_bin_name(bin, warnings)?;
281+
280282
validate_bin_crate_types(bin, edition, warnings, errors)?;
281283
validate_bin_proc_macro(bin, edition, warnings, errors)?;
282284

@@ -587,7 +589,9 @@ fn resolve_targets_with_legacy_path(
587589
);
588590

589591
for target in &toml_targets {
592+
// Check early to improve error messages
590593
validate_target_name(target, target_kind_human, target_kind, warnings)?;
594+
591595
validate_proc_macro(target, target_kind_human, edition, warnings)?;
592596
validate_crate_types(target, target_kind_human, edition, warnings)?;
593597
}

0 commit comments

Comments
 (0)