chore: reformat & clippy cleanup (#96)
Clippy is now added to the `check` in the pipeline Co-authored-by: Ian Letourneau <letourneau.ian@gmail.com> Reviewed-on: #96
This commit is contained in:
@@ -210,7 +210,7 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_load_config_from_local_file() {
|
||||
for path in vec![
|
||||
for path in [
|
||||
"src/tests/data/config-opnsense-25.1.xml",
|
||||
"src/tests/data/config-vm-test.xml",
|
||||
"src/tests/data/config-structure.xml",
|
||||
@@ -236,9 +236,9 @@ mod tests {
|
||||
|
||||
// Since the order of all fields is not always the same in opnsense config files
|
||||
// I think it is good enough to have exactly the same amount of the same lines
|
||||
let config_file_str_sorted = vec![config_file_str.lines().collect::<Vec<_>>()].sort();
|
||||
let serialized_sorted = vec![config_file_str.lines().collect::<Vec<_>>()].sort();
|
||||
assert_eq!(config_file_str_sorted, serialized_sorted);
|
||||
[config_file_str.lines().collect::<Vec<_>>()].sort();
|
||||
[config_file_str.lines().collect::<Vec<_>>()].sort();
|
||||
assert_eq!((), ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ mod tests {
|
||||
///
|
||||
/// * `true` if the package name is found in the CSV string, `false` otherwise.
|
||||
fn is_package_in_csv(csv_string: &str, package_name: &str) -> bool {
|
||||
package_name.len() > 0 && csv_string.split(',').any(|pkg| pkg.trim() == package_name)
|
||||
!package_name.is_empty() && csv_string.split(',').any(|pkg| pkg.trim() == package_name)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -45,7 +45,7 @@ impl SshConfigManager {
|
||||
async fn reload_all_services(&self) -> Result<String, Error> {
|
||||
info!("Reloading all opnsense services");
|
||||
self.opnsense_shell
|
||||
.exec(&format!("configctl service reload all"))
|
||||
.exec("configctl service reload all")
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#[allow(clippy::module_inception)]
|
||||
mod config;
|
||||
mod manager;
|
||||
mod shell;
|
||||
|
||||
@@ -107,7 +107,7 @@ impl OPNsenseShell for SshOPNSenseShell {
|
||||
match result {
|
||||
Ok(bytes) => {
|
||||
if !bytes.is_empty() {
|
||||
remote_file.write(&bytes).await?;
|
||||
AsyncWriteExt::write_all(&mut remote_file, &bytes).await?;
|
||||
}
|
||||
}
|
||||
Err(e) => todo!("Error unhandled {e}"),
|
||||
@@ -194,9 +194,9 @@ async fn wait_for_completion(channel: &mut Channel<Msg>) -> Result<String, Error
|
||||
)));
|
||||
}
|
||||
}
|
||||
russh::ChannelMsg::Success { .. }
|
||||
russh::ChannelMsg::Success
|
||||
| russh::ChannelMsg::WindowAdjusted { .. }
|
||||
| russh::ChannelMsg::Eof { .. } => {}
|
||||
| russh::ChannelMsg::Eof => {}
|
||||
_ => {
|
||||
return Err(Error::Unexpected(format!(
|
||||
"Russh got unexpected msg {msg:?}"
|
||||
|
||||
Reference in New Issue
Block a user