From ecafa7a135a34f2986e5bd9fef1d179fadc0bd07 Mon Sep 17 00:00:00 2001 From: Jorik Cronenberg Date: Fri, 1 Dec 2023 10:41:39 +0100 Subject: [PATCH] Rename MacAddress None to Unset --- rust/agama-dbus-server/src/network/model.rs | 6 +++--- rust/agama-dbus-server/src/network/nm/dbus.rs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rust/agama-dbus-server/src/network/model.rs b/rust/agama-dbus-server/src/network/model.rs index 0e67ead5af..f38c0c32a7 100644 --- a/rust/agama-dbus-server/src/network/model.rs +++ b/rust/agama-dbus-server/src/network/model.rs @@ -354,7 +354,7 @@ pub enum MacAddress { Random, Stable, #[default] - None, + Unset, } impl FromStr for MacAddress { @@ -366,7 +366,7 @@ impl FromStr for MacAddress { "permanent" => Ok(Self::Permanent), "random" => Ok(Self::Random), "stable" => Ok(Self::Stable), - "" => Ok(Self::None), + "" => Ok(Self::Unset), _ => Ok(Self::MacAddress(match macaddr::MacAddr6::from_str(s) { Ok(mac) => mac, Err(e) => return Err(InvalidMacAddress(e.to_string())), @@ -383,7 +383,7 @@ impl fmt::Display for MacAddress { Self::Permanent => "permanent".to_string(), Self::Random => "random".to_string(), Self::Stable => "stable".to_string(), - Self::None => "".to_string(), + Self::Unset => "".to_string(), }; write!(f, "{}", output) } diff --git a/rust/agama-dbus-server/src/network/nm/dbus.rs b/rust/agama-dbus-server/src/network/nm/dbus.rs index 8349bdd6b9..5459ec8fe7 100644 --- a/rust/agama-dbus-server/src/network/nm/dbus.rs +++ b/rust/agama-dbus-server/src/network/nm/dbus.rs @@ -315,11 +315,11 @@ fn base_connection_from_dbus(conn: &OwnedNestedHash) -> Option { Ok(mac) => mac, Err(e) => { log::warn!("Couldn't parse MAC: {}", e); - MacAddress::None + MacAddress::Unset } }; } else { - base_connection.mac_address = MacAddress::None; + base_connection.mac_address = MacAddress::Unset; } } else if let Some(wireless_config) = conn.get(WIRELESS_KEY) { if let Some(mac_address) = wireless_config.get("assigned-mac-address") { @@ -328,11 +328,11 @@ fn base_connection_from_dbus(conn: &OwnedNestedHash) -> Option { Ok(mac) => mac, Err(e) => { log::warn!("Couldn't parse MAC: {}", e); - MacAddress::None + MacAddress::Unset } }; } else { - base_connection.mac_address = MacAddress::None; + base_connection.mac_address = MacAddress::Unset; } }