Skip to content

Commit

Permalink
Fix linter complains
Browse files Browse the repository at this point in the history
  • Loading branch information
KonishchevDmitry committed Nov 22, 2024
1 parent 01a9e56 commit b38e962
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub struct CliArgs {
pub action: Action,
}

#[allow(clippy::large_enum_variant)]
pub enum Action {
List {
full: bool,
Expand Down
6 changes: 3 additions & 3 deletions src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub fn install_spec(config: &mut Config, name: Option<String>, spec: ToolSpec, f
}

fn install_tool(name: &str, spec: &ToolSpec, github: &Github, mut mode: Mode, install_path: &Path) -> EmptyResult {
let tool = crate::tool::check(&install_path)?;
let tool = crate::tool::check(install_path)?;

match (mode, tool.is_some()) {
(Mode::Install{force: false, recheck_spec: false}, true) => {
Expand All @@ -121,7 +121,7 @@ fn install_tool(name: &str, spec: &ToolSpec, github: &Github, mut mode: Mode, in
let asset = release.select_asset(name, spec.release_matcher.as_ref())?;
let release_time: SystemTime = asset.time.into();
let current_version = tool.as_ref().and_then(|_|
version::get_binary_version(&install_path));
version::get_binary_version(install_path));

match mode {
Mode::Install {force, recheck_spec: _} => if tool.is_none() {
Expand Down Expand Up @@ -164,7 +164,7 @@ fn install_tool(name: &str, spec: &ToolSpec, github: &Github, mut mode: Mode, in
},
}

let mut installer = Installer::new(name, &release, spec.binary_matcher.clone(), &install_path, release_time);
let mut installer = Installer::new(name, &release, spec.binary_matcher.clone(), install_path, release_time);

download::download(&asset.url, &asset.name, &mut installer).map_err(|e| format!(
"Failed to download {}: {e}", asset.url))?;
Expand Down
4 changes: 2 additions & 2 deletions src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ struct ToolInfo {
}

fn list_tool(name: &str, spec: &ToolSpec, github: &Github, install_path: &Path, colored: bool) -> ToolInfo {
let tool = crate::tool::check(&install_path).unwrap_or_else(|e| {
let tool = crate::tool::check(install_path).unwrap_or_else(|e| {
error!("{name}: {e}.");
None
});

let installed_version = tool.as_ref().and_then(|_|
version::get_binary_version(&install_path));
version::get_binary_version(install_path));

let mut info = ToolInfo {
name: name.to_owned(),
Expand Down
2 changes: 1 addition & 1 deletion src/matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl Matcher {
Ok(if let Some(regex) = pattern.strip_prefix('~') {
Matcher::Regex(Regex::new(regex)?)
} else {
Matcher::Glob(GlobBuilder::new(&pattern)
Matcher::Glob(GlobBuilder::new(pattern)
.literal_separator(true)
.backslash_escape(true)
.build()?
Expand Down

0 comments on commit b38e962

Please sign in to comment.