Skip to content

Commit

Permalink
Fix CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirbaio committed Oct 31, 2023
1 parent a704c5c commit 8f4b59c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/de.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::{
binary_heap::Kind as BinaryHeapKind, BinaryHeap, Deque, IndexMap, IndexSet, LinearMap, String, Vec,
binary_heap::Kind as BinaryHeapKind, BinaryHeap, Deque, IndexMap, IndexSet, LinearMap, String,
Vec,
};
use core::{
fmt,
Expand Down
3 changes: 2 additions & 1 deletion src/ser.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use core::hash::{BuildHasher, Hash};

use crate::{
binary_heap::Kind as BinaryHeapKind, BinaryHeap, Deque, IndexMap, IndexSet, LinearMap, String, Vec,
binary_heap::Kind as BinaryHeapKind, BinaryHeap, Deque, IndexMap, IndexSet, LinearMap, String,
Vec,
};
use serde::ser::{Serialize, SerializeMap, SerializeSeq, Serializer};

Expand Down
15 changes: 6 additions & 9 deletions src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ impl<const N: usize> String<N> {
/// ```
/// use heapless::String;
///
/// let mut s: String<8> = String::from("foo");
/// let mut s: String<8> = String::try_from("foo").unwrap();
///
/// assert_eq!(s.remove(0), 'f');
/// assert_eq!(s.remove(1), 'o');
Expand All @@ -365,12 +365,9 @@ impl<const N: usize> String<N> {

let next = index + ch.len_utf8();
let len = self.len();
let ptr = self.vec.as_mut_ptr();
unsafe {
core::ptr::copy(
self.vec.as_ptr().add(next),
self.vec.as_mut_ptr().add(index),
len - next,
);
core::ptr::copy(ptr.add(next), ptr.add(index), len - next);
self.vec.set_len(len - (next - index));
}
ch
Expand Down Expand Up @@ -842,14 +839,14 @@ mod tests {

#[test]
fn remove() {
let mut s: String<8> = String::from("foo");
let mut s: String<8> = String::try_from("foo").unwrap();
assert_eq!(s.remove(0), 'f');
assert_eq!(s.as_str(), "oo");
}

#[test]
fn remove_uenc() {
let mut s: String<8> = String::from("ĝėēƶ");
let mut s: String<8> = String::try_from("ĝėēƶ").unwrap();
assert_eq!(s.remove(2), 'ė');
assert_eq!(s.remove(2), 'ē');
assert_eq!(s.remove(2), 'ƶ');
Expand All @@ -858,7 +855,7 @@ mod tests {

#[test]
fn remove_uenc_combo_characters() {
let mut s: String<8> = String::from("héy");
let mut s: String<8> = String::try_from("héy").unwrap();
assert_eq!(s.remove(2), '\u{0301}');
assert_eq!(s.as_str(), "hey");
}
Expand Down

0 comments on commit 8f4b59c

Please sign in to comment.