refactor(semantic): use is_empty() instead of len() == 0 (#4532)

It's preferred to use `is_empty` where possible. `is_empty` is sometimes slightly more optimized than `len() == 0`.
This commit is contained in:
overlookmotel 2024-07-29 15:42:05 +00:00
parent 9db42592af
commit 7b5e1f5ac8
2 changed files with 2 additions and 2 deletions

View file

@ -87,7 +87,7 @@ impl<'a> AstNodes<'a> {
#[inline]
pub fn is_empty(&self) -> bool {
self.nodes.len() == 0
self.nodes.is_empty()
}
/// Walk up the AST, iterating over each parent node.

View file

@ -41,7 +41,7 @@ impl ScopeTree {
#[inline]
pub fn is_empty(&self) -> bool {
self.len() == 0
self.parent_ids.is_empty()
}
pub fn ancestors(&self, scope_id: ScopeId) -> impl Iterator<Item = ScopeId> + '_ {