From 3b51721d1371ee87120787d740772664058f9758 Mon Sep 17 00:00:00 2001 From: Cyborus04 <87248184+Cyborus04@users.noreply.github.com> Date: Thu, 11 Nov 2021 12:12:45 -0500 Subject: [PATCH] `const`-ify `BytesMut::len`, `BytesMut::is_empty`, and `BytesMut::capacity`, --- src/bytes_mut.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs index 147484d53..3da61e1ed 100644 --- a/src/bytes_mut.rs +++ b/src/bytes_mut.rs @@ -177,7 +177,7 @@ impl BytesMut { /// assert_eq!(b.len(), 5); /// ``` #[inline] - pub fn len(&self) -> usize { + pub const fn len(&self) -> usize { self.len } @@ -192,7 +192,7 @@ impl BytesMut { /// assert!(b.is_empty()); /// ``` #[inline] - pub fn is_empty(&self) -> bool { + pub const fn is_empty(&self) -> bool { self.len == 0 } @@ -207,7 +207,7 @@ impl BytesMut { /// assert_eq!(b.capacity(), 64); /// ``` #[inline] - pub fn capacity(&self) -> usize { + pub const fn capacity(&self) -> usize { self.cap }