]> git.proxmox.com Git - cargo.git/commitdiff
Update src/bin/cargo/commands/help.rs
authorSean Stangl <sean.stangl@gmail.com>
Sun, 12 Dec 2021 03:55:38 +0000 (20:55 -0700)
committerGitHub <noreply@github.com>
Sun, 12 Dec 2021 03:55:38 +0000 (20:55 -0700)
Co-authored-by: Weihang Lo <weihanglo@users.noreply.github.com>
src/bin/cargo/commands/help.rs

index 215fef33808827fba7086b3dfd53954c84bda8a6..30abc93aebc965a5832b239bb640dfb8d5581f80 100644 (file)
@@ -94,11 +94,8 @@ fn check_alias(config: &Config, subcommand: &str) -> Option<Vec<String>> {
 /// Checks if the given subcommand is a built-in command (not via an alias).
 ///
 /// Returns None if it is not a built-in command.
-fn check_builtin(subcommand: &str) -> Option<String> {
-    match super::builtin_exec(subcommand) {
-        Some(_) => Some(subcommand.to_string()),
-        None => None,
-    }
+fn check_builtin(subcommand: &str) -> Option<&str> {
+    super::builtin_exec(subcommand).map(|_| subcommand)
 }
 
 /// Extracts the given man page from the compressed archive.