Misc cleanup

This commit is contained in:
Zhaofeng Li 2021-11-23 13:33:23 -08:00
parent e2bad26be5
commit a42e8c5bf0
20 changed files with 89 additions and 121 deletions

View file

@ -112,7 +112,7 @@ pub async fn hive_from_args(args: &ArgMatches<'_>) -> NixResult<Hive> {
let path = args.value_of("config").expect("The config arg should exist").to_owned();
let fpath = canonicalize_cli_path(&path);
if !fpath.exists() && path.contains(":") {
if !fpath.exists() && path.contains(':') {
// Treat as flake URI
let flake = Flake::from_uri(path).await?;
let hive_path = HivePath::Flake(flake);
@ -157,7 +157,7 @@ The list is comma-separated and globs are supported. To match tags, prepend the
}
fn canonicalize_cli_path(path: &str) -> PathBuf {
if !path.starts_with("/") {
if !path.starts_with('/') {
format!("./{}", path).into()
} else {
path.into()