mirror of
https://github.com/tree-sitter/tree-sitter.git
synced 2026-09-10 07:26:23 -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.
This commit is contained in:
parent
ee0c20b1f5
commit
068db86ca9
|
|
@ -4623,7 +4623,7 @@ fn test_query_with_no_patterns() {
|
||||||
allocations::record(|| {
|
allocations::record(|| {
|
||||||
let language = get_language("javascript");
|
let language = get_language("javascript");
|
||||||
let query = Query::new(&language, "").unwrap();
|
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);
|
assert_eq!(query.pattern_count(), 0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -458,7 +458,7 @@ impl Nfa {
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn last_state_id(&self) -> u32 {
|
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
|
self.states.len() as u32 - 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue