Skip to content

Commit 9c4e969

Browse files
committed
rust: adt: Test all compatible strings in adt_is_compatible()
Fixes a regression in the ADT rust reimplementation checking only the first compatible. Closes: #496 Fixes: 5bc1d2f ("adt: replace adt_is_compatible() with Rust") Signed-off-by: Janne Grunau <[email protected]>
1 parent 3cdfd97 commit 9c4e969

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

rust/src/adt.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,8 @@ impl ADTNode {
453453
}
454454

455455
pub fn is_compatible(&self, compatible: &str) -> Result<bool, AdtError> {
456-
Ok(self.named_prop("compatible")?.str()?.contains(compatible))
456+
let prop = self.named_prop("compatible")?;
457+
Ok(prop.str_iter().any(|c| c == compatible))
457458
}
458459

459460
pub fn compatible(&self, index: usize) -> Option<&str> {

0 commit comments

Comments
 (0)