From a154e45cce79b0c2264c1e1cd37a3d1bf5bc6154 Mon Sep 17 00:00:00 2001 From: KyleMiles Date: Thu, 5 Jan 2023 17:29:14 -0500 Subject: Rust API: Lots and lots of clippy changes --- rust/src/rc.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'rust/src/rc.rs') diff --git a/rust/src/rc.rs b/rust/src/rc.rs index 1c7de9da..57deddc3 100644 --- a/rust/src/rc.rs +++ b/rust/src/rc.rs @@ -147,6 +147,7 @@ impl<'a, T> Guard<'a, T> where T: RefCountable, { + #[allow(clippy::should_implement_trait)] // This _is_ out own (lite) version of that trait pub fn clone(&self) -> Ref { unsafe { ::inc_ref(&self.contents) } } @@ -230,6 +231,11 @@ impl Array

{ self.count } + #[inline] + pub fn is_empty(&self) -> bool { + self.count == 0 + } + pub fn into_raw_parts(self) -> (*mut P::Raw, usize) { let me = mem::ManuallyDrop::new(self); (me.contents, me.count) @@ -302,6 +308,11 @@ impl ArrayGuard

{ pub fn len(&self) -> usize { self.count } + + #[inline] + pub fn is_empty(&self) -> bool { + self.count == 0 + } } impl<'a, P: 'a + CoreArrayWrapper<'a> + CoreArrayProvider> ArrayGuard

{ @@ -355,7 +366,7 @@ where fn next(&mut self) -> Option { self.it .next() - .map(|r| unsafe { P::wrap_raw(r, &self.context) }) + .map(|r| unsafe { P::wrap_raw(r, self.context) }) } #[inline] @@ -382,7 +393,7 @@ where fn next_back(&mut self) -> Option { self.it .next_back() - .map(|r| unsafe { P::wrap_raw(r, &self.context) }) + .map(|r| unsafe { P::wrap_raw(r, self.context) }) } } -- cgit v1.3.1