From 562c44127df466088c134175670137349fd9c38e Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Tue, 5 Oct 2021 22:07:18 +0200 Subject: [PATCH] fix(package): fix warnings --- espanso-package/src/lib.rs | 2 +- espanso-package/src/provider/git.rs | 4 +--- espanso-package/src/resolver.rs | 4 ++-- espanso-package/src/util/github.rs | 2 +- espanso-package/src/util/gitlab.rs | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/espanso-package/src/lib.rs b/espanso-package/src/lib.rs index 5662a9a..9548291 100644 --- a/espanso-package/src/lib.rs +++ b/espanso-package/src/lib.rs @@ -100,6 +100,6 @@ pub(crate) mod tests { let tmp_dir = TempDir::new("espanso-package").unwrap(); let tmp_path = tmp_dir.path(); - action(&tmp_path); + action(tmp_path); } } diff --git a/espanso-package/src/provider/git.rs b/espanso-package/src/provider/git.rs index 27e8eef..a382c44 100644 --- a/espanso-package/src/provider/git.rs +++ b/espanso-package/src/provider/git.rs @@ -44,9 +44,7 @@ impl GitPackageProvider { } fn clone_repo(dest_dir: &Path, repo_url: &str, repo_branch: Option<&str>) -> Result<()> { - let mut args = Vec::new(); - - args.push("clone"); + let mut args = vec!["clone"]; if let Some(branch) = repo_branch { args.push("-b"); diff --git a/espanso-package/src/resolver.rs b/espanso-package/src/resolver.rs index 430e972..ceab97b 100644 --- a/espanso-package/src/resolver.rs +++ b/espanso-package/src/resolver.rs @@ -78,7 +78,7 @@ pub fn resolve_all_packages(base_dir: &Path) -> Result> { for manifest_file in manifest_files { let base_dir = manifest_file .parent() - .ok_or(anyhow!("unable to determine base_dir from manifest path"))? + .ok_or_else(|| anyhow!("unable to determine base_dir from manifest path"))? .to_owned(); let manifest = Manifest::parse(&manifest_file).context("manifest YAML parsing error")?; manifests.push(ResolvedPackage { manifest, base_dir }); @@ -331,7 +331,7 @@ mod tests { #[test] fn test_no_manifest_error() { run_with_temp_dir(|base_dir| { - assert_eq!(resolve_all_packages(base_dir).is_err(), true); + assert!(resolve_all_packages(base_dir).is_err()); }); } diff --git a/espanso-package/src/util/github.rs b/espanso-package/src/util/github.rs index d0fc4a6..92680b6 100644 --- a/espanso-package/src/util/github.rs +++ b/espanso-package/src/util/github.rs @@ -114,6 +114,6 @@ mod tests { name: "espanso".to_string(), }); - assert_eq!(extract_github_url_parts("https://gitlab.com/federicoterzi/espanso-test-package/").is_none(), true); + assert!(extract_github_url_parts("https://gitlab.com/federicoterzi/espanso-test-package/").is_none()); } } diff --git a/espanso-package/src/util/gitlab.rs b/espanso-package/src/util/gitlab.rs index 3b57a22..97dd960 100644 --- a/espanso-package/src/util/gitlab.rs +++ b/espanso-package/src/util/gitlab.rs @@ -113,6 +113,6 @@ mod tests { name: "espanso-test-package".to_string(), }); - assert_eq!(extract_gitlab_url_parts("https://github.com/federicoterzi/espanso-test-package/").is_none(), true); + assert!(extract_gitlab_url_parts("https://github.com/federicoterzi/espanso-test-package/").is_none()); } }