fix(package): fix warnings

This commit is contained in:
Federico Terzi 2021-10-05 22:07:18 +02:00
parent 16350123d2
commit 562c44127d
5 changed files with 6 additions and 8 deletions

View File

@ -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);
}
}

View File

@ -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");

View File

@ -78,7 +78,7 @@ pub fn resolve_all_packages(base_dir: &Path) -> Result<Vec<ResolvedPackage>> {
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());
});
}

View File

@ -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());
}
}

View File

@ -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());
}
}