From bc1fd29529ad2b3f1e5582ec15e728b9e67e84f2 Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Fri, 25 Oct 2024 11:48:07 +0200 Subject: [PATCH] Borrow xdg variable instead of cloning --- src/cli/cmd/login/mod.rs | 2 +- src/cli/cmd/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli/cmd/login/mod.rs b/src/cli/cmd/login/mod.rs index e59e921..d7e7b38 100644 --- a/src/cli/cmd/login/mod.rs +++ b/src/cli/cmd/login/mod.rs @@ -191,7 +191,7 @@ impl LoginSubcommand { let xdg = xdg::BaseDirectories::new()?; - let netrc_path = get_netrc_path(xdg.clone()).await?; + let netrc_path = get_netrc_path(&xdg).await?; // $XDG_CONFIG_HOME/nix/nix.conf; basically ~/.config/nix/nix.conf let nix_config_path = xdg.place_config_file("nix/nix.conf")?; diff --git a/src/cli/cmd/mod.rs b/src/cli/cmd/mod.rs index afe9ecd..e9471c5 100644 --- a/src/cli/cmd/mod.rs +++ b/src/cli/cmd/mod.rs @@ -483,7 +483,7 @@ fn validate_segment(s: &str) -> Result<(), FhError> { // See if the netrc exists at the /nix/var/determinate/netrc and, if not, try // to find it via XDG path. -async fn get_netrc_path(xdg: BaseDirectories) -> Result { +async fn get_netrc_path(xdg: &BaseDirectories) -> Result { match try_exists(DET_NIX_NETRC_PATH).await { Ok(exists) if exists => Ok(PathBuf::from(DET_NIX_NETRC_PATH)), _ => {