]> git.proxmox.com Git - cargo.git/commitdiff
improve formatting
authorakabinds <staticxxd@gmail.com>
Wed, 3 Aug 2022 03:45:51 +0000 (22:45 -0500)
committerakabinds <staticxxd@gmail.com>
Wed, 3 Aug 2022 03:45:51 +0000 (22:45 -0500)
src/bin/cargo/main.rs

index 2cc3ab897ef93ca78a8342dffc5d278e0b71ea48..d09ce74a78aff926df8afbda9de04d9c593cfef1 100644 (file)
@@ -167,16 +167,22 @@ fn execute_external_subcommand(config: &Config, cmd: &str, args: &[&str]) -> Cli
         Some(command) => command,
         None => {
             let err = if cmd.starts_with('+') {
-                anyhow::format_err!("no such subcommand: `{}`\n\n\tCargo does not handle `+toolchain` directives.\n\tDid you mean to run `cargo` through `rustup` instead?", cmd)
+                anyhow::format_err!(
+                    "no such subcommand: `{}`\n\n\t\
+                    Cargo does not handle `+toolchain` directives.\n\t\
+                    Did you mean to run `cargo` through `rustup` instead?",
+                    cmd
+                )
             } else {
                 let suggestions = list_commands(config);
                 let did_you_mean = closest_msg(cmd, suggestions.keys(), |c| c);
 
-                if did_you_mean.is_empty() {
-                    anyhow::format_err!("no such subcommand: `{}`\n\n\tView all installed commands with `cargo --list`", cmd)
-                } else {
-                    anyhow::format_err!("no such subcommand: `{}`{}\n\tView all installed commands with `cargo --list`", cmd, did_you_mean)
-                }
+                anyhow::format_err!(
+                    "no such subcommand: `{}`{}\n\n\t\
+                    View all installed commands with `cargo --list`",
+                    cmd,
+                    did_you_mean
+                )
             };
 
             return Err(CliError::new(err, 101));