summaryrefslogtreecommitdiff
path: root/src/syntax/node.rs
diff options
context:
space:
mode:
authorMarek Barvíř <barvirm@gmail.com>2023-03-31 17:13:31 +0200
committerGitHub <noreply@github.com>2023-03-31 17:13:31 +0200
commit4161bad54f690e77f53ca1f0f4426161e60fa4ce (patch)
tree4cde0d6d8d2b536871230f84dcf0fbec798f4056 /src/syntax/node.rs
parent418bd89ba4c5f50c7e279a84d7a0e3c51d319449 (diff)
FIX lint clippy::len_without_is_empty (#451)
Diffstat (limited to 'src/syntax/node.rs')
-rw-r--r--src/syntax/node.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/syntax/node.rs b/src/syntax/node.rs
index afbebe97..3c9bc049 100644
--- a/src/syntax/node.rs
+++ b/src/syntax/node.rs
@@ -53,6 +53,11 @@ impl SyntaxNode {
}
}
+ /// Return `true` if the length is 0.
+ pub fn is_empty(&self) -> bool {
+ self.len() == 0
+ }
+
/// The byte length of the node in the source text.
pub fn len(&self) -> usize {
match &self.0 {