mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
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:
parent
9db42592af
commit
7b5e1f5ac8
2 changed files with 2 additions and 2 deletions
|
|
@ -87,7 +87,7 @@ impl<'a> AstNodes<'a> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
self.nodes.len() == 0
|
self.nodes.is_empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Walk up the AST, iterating over each parent node.
|
/// Walk up the AST, iterating over each parent node.
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ impl ScopeTree {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_empty(&self) -> bool {
|
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> + '_ {
|
pub fn ancestors(&self, scope_id: ScopeId) -> impl Iterator<Item = ScopeId> + '_ {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue