From d3e080e554c732fd629712aae61c45cc79151fc0 Mon Sep 17 00:00:00 2001 From: Ron Waldon-Howe Date: Sat, 16 Nov 2024 11:53:05 +1100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20Remove=20`Default`=20trait=20fro?= =?UTF-8?q?m=20(send|receive=5F*)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/dbus2/busd/pull/159#discussion_r1842120472 --- src/config.rs | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/src/config.rs b/src/config.rs index fb8ed81..7371b76 100644 --- a/src/config.rs +++ b/src/config.rs @@ -402,7 +402,7 @@ impl TryFrom for OptionalPolicy { } } -#[derive(Clone, Debug, Default, Deserialize, PartialEq)] +#[derive(Clone, Debug, Deserialize, PartialEq)] pub struct ReceiveOperation { pub error: Option, pub interface: Option, @@ -531,7 +531,7 @@ fn rules_try_from_rule_elements(value: Vec) -> Result> { pub type Rule = (Access, Operation); -#[derive(Clone, Debug, Default, Deserialize, PartialEq)] +#[derive(Clone, Debug, Deserialize, PartialEq)] pub struct SendOperation { pub broadcast: Option, pub destination: Option, @@ -845,10 +845,16 @@ mod tests { ( Access::Allow, Operation::Send(SendOperation { + broadcast: None, destination: Some(Destination::Prefix(String::from( "org.freedesktop" ))), - ..Default::default() + error: None, + interface: None, + max_fds: None, + min_fds: None, + path: None, + r#type: None }) ), // `` has nothing left after dropping eavesdrop @@ -922,12 +945,16 @@ mod tests { ( Access::Allow, Operation::Send(SendOperation { + broadcast: None, destination: Some(Destination::Name(String::from( "org.gnome.DisplayManager" ))), interface: Some(String::from("org.gnome.DisplayManager.Manager")), - // `member=... is dropped` - ..Default::default() + error: None, + max_fds: None, + min_fds: None, + path: None, + r#type: None }), ), ]),