diff options
author | Marc Cornellà <hello@mcornella.com> | 2022-01-05 09:10:32 +0100 |
---|---|---|
committer | Marc Cornellà <hello@mcornella.com> | 2022-01-05 09:23:54 +0100 |
commit | d3bb52d7d825f2a6ce2e1c76ca472b05c6f27b40 (patch) | |
tree | ce376dce8b593ee56657bedb45c8c18b66a636c2 /plugins/rust | |
parent | 31d63ea884e8ef56a40bed8771cdd8d3aec131f9 (diff) | |
download | zsh-d3bb52d7d825f2a6ce2e1c76ca472b05c6f27b40.tar.gz zsh-d3bb52d7d825f2a6ce2e1c76ca472b05c6f27b40.tar.bz2 zsh-d3bb52d7d825f2a6ce2e1c76ca472b05c6f27b40.zip |
style: declare globals properly
By default, `typeset` defines variables locally unless in the main scope.
This is specially bad when using `omz plugin load`, which happens inside
a function, so the declared variables don't continue being defined when
the function finishes and the main scope reappears.
Diffstat (limited to 'plugins/rust')
-rw-r--r-- | plugins/rust/rust.plugin.zsh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/rust/rust.plugin.zsh b/plugins/rust/rust.plugin.zsh index 014c73b3b..465b701b0 100644 --- a/plugins/rust/rust.plugin.zsh +++ b/plugins/rust/rust.plugin.zsh @@ -11,7 +11,7 @@ command mkdir -p "$ZSH_CACHE_DIR/completions" # bind it to `cargo`. Otherwise, compinit will have already done that if [[ ! -f "$ZSH_CACHE_DIR/completions/_cargo" ]]; then autoload -Uz _cargo - declare -A _comps + typeset -g -A _comps _comps[cargo]=_cargo fi @@ -19,7 +19,7 @@ fi # bind it to `rustup`. Otherwise, compinit will have already done that if [[ ! -f "$ZSH_CACHE_DIR/completions/_rustup" ]]; then autoload -Uz _rustup - declare -A _comps + typeset -g -A _comps _comps[rustup]=_rustup fi |