This commit is contained in:
Brendan Hansknecht 2023-03-06 21:02:47 -08:00
parent 75e996c445
commit 11cccde050
No known key found for this signature in database
GPG key ID: 0EA784685083E75B
6 changed files with 22 additions and 22 deletions

View file

@ -154,7 +154,7 @@ impl RocStr {
/// bytes over - in other words, calling this `as_str` method and then calling `to_string`
/// on that.
pub fn as_str(&self) -> &str {
&*self
self
}
/// Create an empty RocStr with enough space preallocated to store
@ -562,8 +562,8 @@ impl Deref for RocStr {
fn deref(&self) -> &Self::Target {
match self.as_enum_ref() {
RocStrInnerRef::HeapAllocated(h) => unsafe { core::str::from_utf8_unchecked(&*h) },
RocStrInnerRef::SmallString(s) => &*s,
RocStrInnerRef::HeapAllocated(h) => unsafe { core::str::from_utf8_unchecked(h) },
RocStrInnerRef::SmallString(s) => s,
}
}
}