Skip to content

Commit

Permalink
Simplify print
Browse files Browse the repository at this point in the history
  • Loading branch information
olivier-lacroix committed Apr 5, 2024
1 parent 54d6772 commit d09885a
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/cli/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,22 +193,14 @@ pub async fn execute(args: Args) -> miette::Result<()> {
name
);
// Inform about the addition of environments from extras (if any)
let envs = environments
.keys()
.map(AsRef::as_ref)
.collect::<Vec<&str>>();
if envs.len() > 1 {
if !environments.is_empty() {
let envs: Vec<&str> = environments.keys().map(AsRef::as_ref).collect();
eprintln!(

Check failure on line 198 in src/cli/init.rs

View workflow job for this annotation

GitHub Actions / Cargo Lint

`format!` in `eprintln!` args
"{}Added environments {} from optional extras.",
"{}Added environment{} {} from optional extras.",
console::style(console::Emoji("✔ ", "")).green(),
if envs.len() > 1 { "s" } else { "" },
format!("'{}'", envs.join("', '"))
)
} else if envs.len() == 1 {
eprintln!(
"{}Added environment {} from optional extras.",
console::style(console::Emoji("✔ ", "")).green(),
format!("'{}'", envs[0])
)
}
}
}
Expand Down

0 comments on commit d09885a

Please sign in to comment.