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 <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2021-04-21 14:25:55 +10:00
parent b0190a407f
commit 7b83b7ec1f

View File

@ -245,11 +245,13 @@ mod tests {
#[tokio::test] #[tokio::test]
async fn test_wait_for_uevent() { async fn test_wait_for_uevent() {
let mut uev = crate::uevent::Uevent::default(); let uev = Uevent {
uev.action = crate::linux_abi::U_EVENT_ACTION_ADD.to_string(); action: crate::linux_abi::U_EVENT_ACTION_ADD.to_string(),
uev.subsystem = "test".to_string(); subsystem: "test".to_string(),
uev.devpath = "/test/sysfs/path".to_string(); devpath: "/test/sysfs/path".to_string(),
uev.devname = "testdevname".to_string(); devname: "testdevname".to_string(),
..Default::default()
};
let matcher = AlwaysMatch(); let matcher = AlwaysMatch();