chiark / gitweb /
wdt: Break out find_conflict
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 14 Mar 2021 20:36:11 +0000 (20:36 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 14 Mar 2021 20:36:11 +0000 (20:36 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
wdriver/wdriver.rs
wdriver/wdt-simple.rs

index f1f2370841703847c35ee9e8a935f4ac6c760fb5..76ee892a3b0c913c182b14009c5be8da99adc7ee 100644 (file)
@@ -314,6 +314,13 @@ impl<'g> WindowGuard<'g> {
 
 }
 
+#[ext(pub)]
+impl Vec<String> {
+  fn find_conflict(&self) -> Option<&String> {
+    self.iter().find(|m| m.starts_with("Conflict!"))
+  }
+}
+
 pub type WebCoord = i32;
 pub type WebPos = (WebCoord, WebCoord);
 
index 6f38cd539f92b27a934d56a6a4dfd15db889e38f..88b9e281931a5b4ea191e44bcb1c2e46bc9b268f 100644 (file)
@@ -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);
     }
   }