mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 15:51:12 +00:00
cleanups in roc_std
This commit is contained in:
parent
88575b2140
commit
6d55acc5cf
3 changed files with 7 additions and 8 deletions
|
@ -304,7 +304,6 @@ impl RocStr {
|
|||
// The backing list was not unique, so we can't mutate it in-place.
|
||||
// ask for `len + 1` to store the original string and the terminator
|
||||
with_stack_bytes(len + 1, |alloc_ptr: *mut u8| {
|
||||
let alloc_ptr = alloc_ptr as *mut u8;
|
||||
let elem_ptr = roc_list.ptr_to_first_elem() as *mut u8;
|
||||
|
||||
// memcpy the bytes into the stack allocation
|
||||
|
@ -331,7 +330,7 @@ impl RocStr {
|
|||
|
||||
// Even if the small string is at capacity, there will be room to write
|
||||
// a terminator in the byte that's used to store the length.
|
||||
terminate(bytes.as_mut_ptr() as *mut u8, small_str.len())
|
||||
terminate(bytes.as_mut_ptr(), small_str.len())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -534,7 +533,7 @@ impl RocStr {
|
|||
// No need to do a heap allocation for an empty string - we
|
||||
// can just do a stack allocation that will live for the
|
||||
// duration of the function.
|
||||
func([terminator].as_mut_ptr() as *mut E, "")
|
||||
func([terminator].as_mut_ptr(), "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -620,7 +619,7 @@ impl Eq for RocStr {}
|
|||
|
||||
impl PartialOrd for RocStr {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
|
||||
self.as_str().partial_cmp(other.as_str())
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue