This commit is contained in:
veeso
2023-02-09 17:30:14 +01:00
parent 1db2ff7ec5
commit efd2235ff3
5 changed files with 9 additions and 24 deletions

View File

@@ -40,9 +40,7 @@ impl Builder {
}
(protocol, params) => {
error!("Invalid params for protocol '{:?}'", protocol);
panic!(
"Invalid protocol '{protocol:?}' with parameters of type {params:?}"
)
panic!("Invalid protocol '{protocol:?}' with parameters of type {params:?}")
}
}
}

View File

@@ -32,8 +32,7 @@ pub fn init(level: LogLevel) -> Result<(), String> {
// Prepare log config
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}"))
WriteLogger::init(level, config, file).map_err(|e| format!("Failed to initialize logger: {e}"))
}
#[cfg(test)]

View File

@@ -158,9 +158,7 @@ impl FileTransferActivity {
trace!("The user doesn't want to create the directory; disabling synchronized browsing");
self.log(
LogLevel::Warn,
format!(
"Refused to create '{name}'; synchronized browsing disabled"
),
format!("Refused to create '{name}'; synchronized browsing disabled"),
);
self.browser.toggle_sync_browsing();
self.refresh_remote_status_bar();

View File

@@ -17,10 +17,7 @@ impl FileTransferActivity {
}
}
if file_exists {
self.log_and_alert(
LogLevel::Warn,
format!("File \"{input}\" already exists",),
);
self.log_and_alert(LogLevel::Warn, format!("File \"{input}\" already exists",));
return;
}
// Create file
@@ -47,20 +44,16 @@ impl FileTransferActivity {
}
}
if file_exists {
self.log_and_alert(
LogLevel::Warn,
format!("File \"{input}\" already exists",),
);
self.log_and_alert(LogLevel::Warn, format!("File \"{input}\" already exists",));
return;
}
// Get path on remote
let file_path: PathBuf = PathBuf::from(input.as_str());
// Create file (on local)
match tempfile::NamedTempFile::new() {
Err(err) => self.log_and_alert(
LogLevel::Error,
format!("Could not create tempfile: {err}"),
),
Err(err) => {
self.log_and_alert(LogLevel::Error, format!("Could not create tempfile: {err}"))
}
Ok(tfile) => {
// Stat tempfile
let local_file: File = match self.host.stat(tfile.path()) {

View File

@@ -27,10 +27,7 @@ impl FileTransferActivity {
);
}
Err(err) => {
self.log_and_alert(
LogLevel::Error,
format!("Could not create symlink: {err}"),
);
self.log_and_alert(LogLevel::Error, format!("Could not create symlink: {err}"));
}
}
}