From 85f93f0de4268333df18bcd9fde6c9b0f74836e2 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Fri, 12 Jan 2024 22:36:22 -0800 Subject: Apply a clippy suggestion. --- src/rope.rs | 8 ++++++-- 1 file 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()) { -- cgit v1.3.1