From 155992d1cc0c1dc524a23ff7e1c79a6bfc9b973e Mon Sep 17 00:00:00 2001 From: qwjyh Date: Wed, 19 Jun 2024 17:37:19 +0900 Subject: [PATCH] fix clippy warnings --- src/cmd_init.rs | 2 +- src/devices.rs | 1 + src/inquire_filepath_completer.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cmd_init.rs b/src/cmd_init.rs index 7872aa2..415489a 100644 --- a/src/cmd_init.rs +++ b/src/cmd_init.rs @@ -44,7 +44,7 @@ fn clone_repo( .context("No username found from the url") .unwrap(), None, - &key as &Path, + key as &Path, passwd.as_deref(), ) } else if use_sshagent { diff --git a/src/devices.rs b/src/devices.rs index be81adb..8aba252 100644 --- a/src/devices.rs +++ b/src/devices.rs @@ -88,6 +88,7 @@ pub fn write_devices(config_dir: &Path, devices: Vec) -> Result<()> { trace!("write_devices"); let f = OpenOptions::new() .create(true) + .truncate(true) .write(true) .open(config_dir.join(DEVICESFILE))?; let writer = BufWriter::new(f); diff --git a/src/inquire_filepath_completer.rs b/src/inquire_filepath_completer.rs index d63fd24..9c8c905 100644 --- a/src/inquire_filepath_completer.rs +++ b/src/inquire_filepath_completer.rs @@ -17,7 +17,7 @@ impl FilePathCompleter { return Ok(()); } - self.input = input.to_owned(); + input.clone_into(&mut self.input); self.paths.clear(); let input_path = std::path::PathBuf::from(input);