mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
always slice a big string as a slice (not as a small string)
This commit is contained in:
parent
37ef3549c8
commit
f570444901
1 changed files with 1 additions and 1 deletions
|
@ -256,7 +256,7 @@ impl RocStr {
|
|||
pub fn try_slice_range(&self, range: Range<usize>) -> Option<Self> {
|
||||
if self.as_str().get(range.start..range.end).is_none() {
|
||||
None
|
||||
} else if range.end - range.start <= SmallString::CAPACITY {
|
||||
} else if range.end - range.start <= SmallString::CAPACITY && self.is_small_str() {
|
||||
let slice = &self.as_bytes()[range];
|
||||
let small_string =
|
||||
unsafe { SmallString::try_from_utf8_bytes(slice).unwrap_unchecked() };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue