Skip to content

Commit

Permalink
Update validate_smart function to use the class with the greatest n…
Browse files Browse the repository at this point in the history
…umber of matching fields

* Modify logic to compare the number of matching fields for each class
* Fix mismatched types error by dereferencing the borrow
  • Loading branch information
benglewis committed Jan 29, 2025
1 parent f8dfa9f commit 389b6e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/validators/union.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl UnionValidator {
.map_or(true, |(_, cur_exactness, cur_fields_set_count, cur_num_fields)| {
match (*cur_fields_set_count, new_fields_set_count) {
(Some(cur), Some(new)) if cur != new => cur < new,
(Some(cur), Some(new)) if cur == new => cur_num_fields < new_num_fields,
(Some(cur), Some(new)) if cur == new => *cur_num_fields < new_num_fields,
_ => *cur_exactness < new_exactness,
}
});
Expand Down

0 comments on commit 389b6e8

Please sign in to comment.