Skip to content

Commit

Permalink
refactor: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelmauro committed Oct 18, 2024
1 parent f058b06 commit 9c34cc0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions zkstack_cli/crates/zkstack/src/commands/autocomplete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ pub fn generate_completions<G: Generator>(gen: G, buf: &mut dyn Write) -> anyhow
}

pub trait ShellAutocomplete {
fn autocomplete_file_name(&self) -> String;
fn autocomplete_file_name(&self) -> &'static str;
}

impl ShellAutocomplete for clap_complete::Shell {
fn autocomplete_file_name(&self) -> String {
fn autocomplete_file_name(&self) -> &'static str {
match self {
clap_complete::Shell::Bash => format!("zkstack.sh"),
clap_complete::Shell::Fish => format!("zkstack.fish"),
clap_complete::Shell::Zsh => format!("_zkstack.zsh"),
clap_complete::Shell::Bash => "zkstack.sh",
clap_complete::Shell::Fish => "zkstack.fish",
clap_complete::Shell::Zsh => "_zkstack.zsh",
_ => todo!(),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ fn lint_autocompletion_files(_shell: &Shell, check: bool) -> anyhow::Result<()>

let new = String::from_utf8(writer)?;

let path = completion_folder.join(&Path::new(shell.autocomplete_file_name().as_str()));
let path = completion_folder.join(shell.autocomplete_file_name());
let mut autocomplete_file = File::open(path.clone())
.context(format!("failed to open {}", shell.autocomplete_file_name()))?;

Expand Down

0 comments on commit 9c34cc0

Please sign in to comment.