mirror of
https://github.com/tree-sitter/tree-sitter.git
synced 2026-09-10 07:36:22 -04:00
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.
(cherry picked from commit 068db86ca9)
This commit is contained in:
parent
9111e31719
commit
86db89f16c
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue