clippy
This commit is contained in:
@@ -6,6 +6,7 @@ use jmb_logger_rs::*;
|
||||
use std::io::Read;
|
||||
use std::net::Shutdown;
|
||||
use std::os::unix::net::UnixListener;
|
||||
use std::str::FromStr;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
pub struct ControlSocket {
|
||||
@@ -34,11 +35,11 @@ impl SimpleBackendThread<ControlCommand> for ControlSocket {
|
||||
}
|
||||
});
|
||||
std::thread::spawn(move || {
|
||||
if std::fs::metadata(SOCKET_PATH).is_ok() {
|
||||
if let Err(e) = std::fs::remove_file(SOCKET_PATH) {
|
||||
error!(&LOGGER, "Error deleting old socket file: {e}");
|
||||
return;
|
||||
}
|
||||
if std::fs::metadata(SOCKET_PATH).is_ok()
|
||||
&& let Err(e) = std::fs::remove_file(SOCKET_PATH)
|
||||
{
|
||||
error!(&LOGGER, "Error deleting old socket file: {e}");
|
||||
return;
|
||||
}
|
||||
let socket = UnixListener::bind(SOCKET_PATH);
|
||||
let Ok(socket) = socket else {
|
||||
@@ -58,7 +59,7 @@ impl SimpleBackendThread<ControlCommand> for ControlSocket {
|
||||
let _ = stream.shutdown(Shutdown::Both);
|
||||
continue;
|
||||
}
|
||||
if let Some(command) = ControlCommand::from_str(&read) {
|
||||
if let Ok(command) = ControlCommand::from_str(&read) {
|
||||
instance.lock().unwrap().publish(command);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user