Skip to content

Commit

Permalink
Fix string handling
Browse files Browse the repository at this point in the history
  • Loading branch information
cmichi committed Nov 4, 2024
1 parent 663931b commit 8b5ec41
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions crates/cargo-contract/src/cmd/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ macro_rules! call_with_config_internal {
_ => {
let configs = vec![$(stringify!($config)),*].iter()
.map(|s| s.replace(" ", ""))
.map(|s| s.trim_start_matches("$crate::cmd::config::"))
.map(|s| s.trim_start_matches("$crate::cmd::config::").to_string())
.collect::<Vec<_>>()
.join(", ");
Err(ErrorVariant::Generic(
Expand Down Expand Up @@ -263,21 +263,15 @@ macro_rules! call_with_config {
$crate::cmd::config::Substrate,
$crate::cmd::config::Ecdsachain
);

let res_spaced = $crate::call_with_config_internal!(
if !res_nonspaced.is_err() {return res_nonspaced}
$crate::call_with_config_internal!(
$obj,
$function,
config_name_spaced.as_str(),
// All available chain configs need to be specified here
$crate::cmd::config::Polkadot,
$crate::cmd::config::Substrate,
$crate::cmd::config::Ecdsachain
);

if !res_spaced.is_err() {
res_nonspaced
} else {
res_spaced
}
)
}};
}

0 comments on commit 8b5ec41

Please sign in to comment.