Skip to content

Commit 2d16444

Browse files
committed
Fix CI.
1 parent 92b72b1 commit 2d16444

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/de.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::{
2-
binary_heap::Kind as BinaryHeapKind, BinaryHeap, Deque, IndexMap, IndexSet, LinearMap, String, Vec,
2+
binary_heap::Kind as BinaryHeapKind, BinaryHeap, Deque, IndexMap, IndexSet, LinearMap, String,
3+
Vec,
34
};
45
use core::{
56
fmt,

src/ser.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use core::hash::{BuildHasher, Hash};
22

33
use crate::{
4-
binary_heap::Kind as BinaryHeapKind, BinaryHeap, Deque, IndexMap, IndexSet, LinearMap, String, Vec,
4+
binary_heap::Kind as BinaryHeapKind, BinaryHeap, Deque, IndexMap, IndexSet, LinearMap, String,
5+
Vec,
56
};
67
use serde::ser::{Serialize, SerializeMap, SerializeSeq, Serializer};
78

src/string.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ impl<const N: usize> String<N> {
350350
/// ```
351351
/// use heapless::String;
352352
///
353-
/// let mut s: String<8> = String::from("foo");
353+
/// let mut s: String<8> = String::try_from("foo").unwrap();
354354
///
355355
/// assert_eq!(s.remove(0), 'f');
356356
/// assert_eq!(s.remove(1), 'o');
@@ -365,12 +365,9 @@ impl<const N: usize> String<N> {
365365

366366
let next = index + ch.len_utf8();
367367
let len = self.len();
368+
let ptr = self.vec.as_mut_ptr();
368369
unsafe {
369-
core::ptr::copy(
370-
self.vec.as_ptr().add(next),
371-
self.vec.as_mut_ptr().add(index),
372-
len - next,
373-
);
370+
core::ptr::copy(ptr.add(next), ptr.add(index), len - next);
374371
self.vec.set_len(len - (next - index));
375372
}
376373
ch
@@ -842,14 +839,14 @@ mod tests {
842839

843840
#[test]
844841
fn remove() {
845-
let mut s: String<8> = String::from("foo");
842+
let mut s: String<8> = String::try_from("foo").unwrap();
846843
assert_eq!(s.remove(0), 'f');
847844
assert_eq!(s.as_str(), "oo");
848845
}
849846

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

859856
#[test]
860857
fn remove_uenc_combo_characters() {
861-
let mut s: String<8> = String::from("héy");
858+
let mut s: String<8> = String::try_from("héy").unwrap();
862859
assert_eq!(s.remove(2), '\u{0301}');
863860
assert_eq!(s.as_str(), "hey");
864861
}

0 commit comments

Comments
 (0)