From 5a8db1dcf62911e922e225b101e1900913babc23 Mon Sep 17 00:00:00 2001 From: occheung Date: Thu, 22 Aug 2024 17:46:18 +0800 Subject: [PATCH] drtio-mgmt: fmt --- src/satman/src/main.rs | 4 +--- src/satman/src/mgmt.rs | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/satman/src/main.rs b/src/satman/src/main.rs index 278e597..fd3bdc6 100644 --- a/src/satman/src/main.rs +++ b/src/satman/src/main.rs @@ -1218,9 +1218,7 @@ fn process_aux_packet( core_manager.clear_data(); } - drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck { succeeded: succeeded })?; - - Ok(()) + drtioaux::send(0, &drtioaux::Packet::CoreMgmtAck { succeeded: succeeded }) } drtioaux::Packet::CoreMgmtConfigRemoveRequest { destination: _destination, diff --git a/src/satman/src/mgmt.rs b/src/satman/src/mgmt.rs index 340784a..b0ec690 100644 --- a/src/satman/src/mgmt.rs +++ b/src/satman/src/mgmt.rs @@ -21,7 +21,7 @@ pub fn byte_to_level_filter(level_byte: u8) -> Result { lv => { error!("unknown log level: {}", lv); return Err(()); - }, + } }) } @@ -70,14 +70,13 @@ impl<'a> Manager<'_> { } pub fn fetch_config_value(&mut self, key: &str) -> Result<()> { - self.cfg.read(&key) + self.cfg + .read(&key) .map(|value| { debug!("got value"); self.last_value = Sliceable::new(0, value) }) - .map_err(|_| { - warn!("read error: no such key") - }) + .map_err(|_| warn!("read error: no such key")) } pub fn get_config_value_slice(&mut self, data_slice: &mut [u8; CORE_MGMT_PAYLOAD_MAX_SIZE]) -> SliceMeta { @@ -94,18 +93,22 @@ impl<'a> Manager<'_> { } pub fn write_config(&mut self) -> Result<()> { - let key = self.current_payload.read_string().map_err( - |_err| error!("error on reading key"))?; + let key = self + .current_payload + .read_string() + .map_err(|_err| error!("error on reading key"))?; let value = self.current_payload.read_bytes().unwrap(); - self.cfg.write(&key, value) + self.cfg + .write(&key, value) .map(|()| debug!("write success")) .map_err(|err| error!("failed to write: {:?}", err)) } pub fn remove_config(&mut self, key: &str) -> Result<()> { debug!("erase key: {}", key); - self.cfg.remove(&key) + self.cfg + .remove(&key) .map(|()| debug!("erase success")) .map_err(|err| warn!("failed to erase: {:?}", err)) }