Repository: clap-rs/clap (Rust)

Issue:
Redundant code in Zsh completion when there are no subcommands
<!--
Please use the following template to assist with creating an issue and to ensure a speedy resolution. If an area is not applicable, feel free to delete the area or mark with `N/A`
-->

### Rust Version

`rustc 1.23.0 (766bd11c8 2018-01-01)`

### Affected Version of clap

`2.29.0`

### Expected Behavior Summary
There shouldn't be redundant code in the generated Zsh completion code.

### Actual Behavior Summary
There is some redundant code when there are no sub-commands.

**Generated from the sample:**
```zsh
#compdef clap-test

_clap-test() {
    typeset -A opt_args
    local ret=1

    local context curcontext="$curcontext" state line
    _arguments -s -S -C \
'--completions[]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
    
}

(( $+functions[_clap-test_commands] )) ||
_clap-test_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'clap-test commands' commands "$@"
}
(( $+functions[_clap-test_commands] )) ||
_clap-test_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'clap-test commands' commands "$@"
}

_clap-test "$@"
```

Notice the double `_clap-test_commands` part.

### Steps to Reproduce the issue
1. Build the sample.
2. Run `cargo run -- --completions`.
3. Check the output.

### Sample Code or Link to Sample Code
```rust
extern crate clap;

use std::io;
use clap::{App, Arg, Shell};

fn build_cli() -> App<'static, 'static> {
    App::new("clap-test")
        .arg(Arg::with_name("completions")
            .long("completions"))
}

fn main() {
    let matches = build_cli().get_matches();

    if matches.is_present("completions") {
        build_cli().gen_completions_to("clap-test", Shell::Zsh, &mut io::stdout())
    }
}
```

### Debug output
[clap-debug.txt](https://github.com/kbknapp/clap-rs/files/1608772/clap-debug.txt)



Discussion:
@segevfiner since you're already on a roll for these completions PRs, do you want to take a swing at this one? :smile: 
I probaby will 😉 



Patch:
diff --git a/src/completions/mod.rs b/src/completions/mod.rs
index 026b449354d..742c6161956 100644
--- a/src/completions/mod.rs
+++ b/src/completions/mod.rs
@@ -91,12 +91,7 @@ pub fn subcommands_of(p: &Parser) -> Vec<(String, String)> {
         p.has_subcommands()
     );
     if !p.has_subcommands() {
-        let mut ret = vec![
-            (
-                p.meta.name.clone(),
-                p.meta.bin_name.as_ref().unwrap().clone(),
-            ),
-        ];
+        let mut ret = vec![];
         debugln!("subcommands_of: Looking for aliases...");
         if let Some(ref aliases) = p.meta.aliases {
             for &(n, _) in aliases {


Test patch:
diff --git a/tests/completions.rs b/tests/completions.rs
index 91c454b1fe4..84018c8b710 100644
--- a/tests/completions.rs
+++ b/tests/completions.rs
@@ -675,13 +675,6 @@ _my_app() {
     
 }
 
-(( $+functions[_my_app_commands] )) ||
-_my_app_commands() {
-    local commands; commands=(
-        
-    )
-    _describe -t commands 'my_app commands' commands "$@"
-}
 (( $+functions[_my_app_commands] )) ||
 _my_app_commands() {
     local commands; commands=(