From 5289cf91b8ba01148d492f95fbfa16efbdfb7d2a Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 13 May 2024 06:39:34 +0000 Subject: [PATCH] fix incorrect comment in mutf8.rs --- simdnbt/src/mutf8.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/simdnbt/src/mutf8.rs b/simdnbt/src/mutf8.rs index ec3f582..c620959 100644 --- a/simdnbt/src/mutf8.rs +++ b/simdnbt/src/mutf8.rs @@ -92,14 +92,14 @@ impl Mutf8Str { #[inline] pub fn from_str(s: &str) -> Cow { match mutf8::encode(s) { - Cow::Borrowed(b) => Cow::Borrowed(Mutf8Str::from_slice(b)), - Cow::Owned(o) => Cow::Owned(Mutf8String { vec: o }), + Cow::Borrowed(slice) => Cow::Borrowed(Mutf8Str::from_slice(slice)), + Cow::Owned(vec) => Cow::Owned(Mutf8String { vec }), } } #[inline] pub fn to_str(&self) -> Cow { - // fast check to skip if none of the bytes have the top bit set or are null + // fast check to skip if none of the bytes have the top bit set if is_plain_ascii(&self.slice) { // SAFETY: &[u8] and &str are the same layout. unsafe { Cow::Borrowed(std::str::from_utf8_unchecked(&self.slice)) }