aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2024-01-12 22:36:22 -0800
committerRose Hogenson <rosehogenson@posteo.net>2024-01-12 22:36:22 -0800
commit85f93f0de4268333df18bcd9fde6c9b0f74836e2 (patch)
tree0e623ad67b0cbe86ce924e52799ad5498dff03c1
parentb47ac87546ce3607908d806f989d2a7804193e48 (diff)
downloadeditor-85f93f0de4268333df18bcd9fde6c9b0f74836e2.tar.zst
Apply a clippy suggestion.
-rw-r--r--src/rope.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/rope.rs b/src/rope.rs
index e74dd4c..b5b5f36 100644
--- a/src/rope.rs
+++ b/src/rope.rs
@@ -49,6 +49,10 @@ impl Rope {
}
}
+ pub fn is_empty(&self) -> bool {
+ self.len() == 0
+ }
+
pub fn lines(&self) -> usize {
match self {
Rope(Node::Leaf(l)) => usize::from(l.lines),
@@ -194,10 +198,10 @@ impl Rope {
}
pub fn concat(&self, other: &Rope) -> Rope {
- if self.len() == 0 {
+ if self.is_empty() {
return other.clone();
}
- if other.len() == 0 {
+ if other.is_empty() {
return self.clone();
}
match self.concat_height(self.height(), other, other.height()) {