From 79fc465a0aea77f7120f7a4e19b4400d3b77218a Mon Sep 17 00:00:00 2001 From: Marek Kaput Date: Wed, 17 May 2023 16:52:06 +0200 Subject: [PATCH] Reorder code commit-id:7e15b5ed --- scarb/src/core/manifest/toml_manifest.rs | 46 ++++++++++++------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/scarb/src/core/manifest/toml_manifest.rs b/scarb/src/core/manifest/toml_manifest.rs index 95de1e6e7..350e9700c 100644 --- a/scarb/src/core/manifest/toml_manifest.rs +++ b/scarb/src/core/manifest/toml_manifest.rs @@ -318,6 +318,29 @@ impl TomlManifest { Ok(targets) } + fn check_unique_targets(targets: &[Target], package_name: &str) -> Result<()> { + let mut used = HashSet::with_capacity(targets.len()); + for target in targets { + if !used.insert((target.kind.as_str(), target.name.as_str())) { + if target.name == package_name { + bail!( + "manifest contains duplicate target definitions `{}`, \ + consider explicitly naming targets with the `name` field", + target.kind + ) + } else { + bail!( + "manifest contains duplicate target definitions `{} ({})`, \ + use different target names to resolve the conflict", + target.kind, + target.name + ) + } + } + } + Ok(()) + } + fn collect_profiles(&self) -> Result> { if let Some(toml_profiles) = &self.profile { let mut result = Vec::new(); @@ -407,29 +430,6 @@ impl TomlManifest { Ok(profile_definition.tool) } } - - fn check_unique_targets(targets: &[Target], package_name: &str) -> Result<()> { - let mut used = HashSet::with_capacity(targets.len()); - for target in targets { - if !used.insert((target.kind.as_str(), target.name.as_str())) { - if target.name == package_name { - bail!( - "manifest contains duplicate target definitions `{}`, \ - consider explicitly naming targets with the `name` field", - target.kind - ) - } else { - bail!( - "manifest contains duplicate target definitions `{} ({})`, \ - use different target names to resolve the conflict", - target.kind, - target.name - ) - } - } - } - Ok(()) - } } impl TomlDependency {