From 7b83b7ec1f07d4545b653d24d847cd9e0e9965c5 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 21 Apr 2021 14:25:55 +1000 Subject: [PATCH] agent/uevent: Better initialize Uevent in test We had some code that initialized a Uevent to the default value, then set specific fields to various values. This can be accomplished inside the one initialized using the ..Default::default() syntax. Making this change stops clippy from complaining. fixes #1611 Signed-off-by: David Gibson --- src/agent/src/uevent.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/agent/src/uevent.rs b/src/agent/src/uevent.rs index 3d8e12b0d5..d00de30160 100644 --- a/src/agent/src/uevent.rs +++ b/src/agent/src/uevent.rs @@ -245,11 +245,13 @@ mod tests { #[tokio::test] async fn test_wait_for_uevent() { - let mut uev = crate::uevent::Uevent::default(); - uev.action = crate::linux_abi::U_EVENT_ACTION_ADD.to_string(); - uev.subsystem = "test".to_string(); - uev.devpath = "/test/sysfs/path".to_string(); - uev.devname = "testdevname".to_string(); + let uev = Uevent { + action: crate::linux_abi::U_EVENT_ACTION_ADD.to_string(), + subsystem: "test".to_string(), + devpath: "/test/sysfs/path".to_string(), + devname: "testdevname".to_string(), + ..Default::default() + }; let matcher = AlwaysMatch();