fix(rust): address new assert-is-empty nightly lint

The resulting code is arguably uglier, but there is a strong argument
for the improved message when the assert trips.
This commit is contained in:
Will Lillis 2026-09-04 01:35:23 -04:00
parent ee0c20b1f5
commit 068db86ca9
2 changed files with 2 additions and 2 deletions

View file

@ -4623,7 +4623,7 @@ fn test_query_with_no_patterns() {
allocations::record(|| {
let language = get_language("javascript");
let query = Query::new(&language, "").unwrap();
assert!(query.capture_names().is_empty());
assert_eq!(query.capture_names(), [] as [&str; 0]);
assert_eq!(query.pattern_count(), 0);
});
}

View file

@ -458,7 +458,7 @@ impl Nfa {
#[must_use]
pub fn last_state_id(&self) -> u32 {
assert!(!self.states.is_empty());
assert_ne!(self.states, [] as [NfaState; 0]);
self.states.len() as u32 - 1
}
}