This commit is contained in:
veeso
2023-02-09 17:20:48 +01:00
parent 62003308a7
commit 4d5f3a6b63
40 changed files with 139 additions and 147 deletions

View File

@@ -88,7 +88,7 @@ impl BookmarksClient {
error!("Failed to set new key into storage: {}", e);
return Err(SerializerError::new_ex(
SerializerErrorKind::Io,
format!("Could not write key to storage: {}", e),
format!("Could not write key to storage: {e}"),
));
}
// Return key
@@ -98,7 +98,7 @@ impl BookmarksClient {
error!("Failed to get key from storage: {}", e);
return Err(SerializerError::new_ex(
SerializerErrorKind::Io,
format!("Could not get key from storage: {}", e),
format!("Could not get key from storage: {e}"),
));
}
},

View File

@@ -249,7 +249,7 @@ impl ConfigClient {
// Get key path
let ssh_key_path: PathBuf = {
let mut p: PathBuf = self.ssh_key_dir.clone();
p.push(format!("{}.key", host_name));
p.push(format!("{host_name}.key"));
p
};
info!(
@@ -390,7 +390,7 @@ impl ConfigClient {
/// Hosts are saved as `username@host` into configuration.
/// This method creates the key name, starting from host and username
fn make_ssh_host_key(host: &str, username: &str) -> String {
format!("{}@{}", username, host)
format!("{username}@{host}")
}
/// Get ssh tokens starting from ssh host key

View File

@@ -25,7 +25,7 @@ impl FileStorage {
/// Make file path for key file from `dir_path` and the application id
fn make_file_path(&self, storage_id: &str) -> PathBuf {
let mut p: PathBuf = self.dir_path.clone();
let file_name = format!(".{}.key", storage_id);
let file_name = format!(".{storage_id}.key");
p.push(file_name);
p
}

View File

@@ -33,7 +33,7 @@ pub fn init(level: LogLevel) -> Result<(), String> {
let config = ConfigBuilder::new().set_time_format_rfc3339().build();
// Make logger
WriteLogger::init(level, config, file)
.map_err(|e| format!("Failed to initialize logger: {}", e))
.map_err(|e| format!("Failed to initialize logger: {e}"))
}
#[cfg(test)]

View File

@@ -29,7 +29,7 @@ impl SshKeyStorage {
/// Make mapkey from host and username
fn make_mapkey(host: &str, username: &str) -> String {
format!("{}@{}", username, host)
format!("{username}@{host}")
}
#[cfg(test)]
@@ -46,11 +46,11 @@ impl SshKeyStorage {
use std::io::BufReader;
let mut reader = File::open(path)
.map_err(|e| format!("failed to open {}: {}", path, e))
.map_err(|e| format!("failed to open {path}: {e}"))
.map(BufReader::new)?;
SshConfig::default()
.parse(&mut reader)
.map_err(|e| format!("Failed to parse ssh2 config: {}", e))
.map_err(|e| format!("Failed to parse ssh2 config: {e}"))
}
/// Resolve host via termscp ssh keys storage