From 659e56360d36a2e311bd5340a0e9a6dca6ed8517 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 14 Mar 2021 20:36:11 +0000 Subject: [PATCH] wdt: Break out find_conflict Signed-off-by: Ian Jackson --- wdriver/wdriver.rs | 7 +++++++ wdriver/wdt-simple.rs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/wdriver/wdriver.rs b/wdriver/wdriver.rs index f1f23708..76ee892a 100644 --- a/wdriver/wdriver.rs +++ b/wdriver/wdriver.rs @@ -314,6 +314,13 @@ impl<'g> WindowGuard<'g> { } +#[ext(pub)] +impl Vec { + fn find_conflict(&self) -> Option<&String> { + self.iter().find(|m| m.starts_with("Conflict!")) + } +} + pub type WebCoord = i32; pub type WebPos = (WebCoord, WebCoord); diff --git a/wdriver/wdt-simple.rs b/wdriver/wdt-simple.rs index 6f38cd53..88b9e281 100644 --- a/wdriver/wdt-simple.rs +++ b/wdriver/wdt-simple.rs @@ -264,7 +264,7 @@ impl Ctx { assert_eq!(n.held, y.held); for got in &gots { - let conflict = got.log.iter().any(|m| m.starts_with("Conflict!")); + let conflict = got.log.find_conflict().is_some(); assert_eq!(conflict, !got.yes); } } -- 2.30.2