Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ use crate::dynamic::{DynamicVec, InlineVec};
#[clippy::format_args]
macro_rules! eco_format {
($($tts:tt)*) => {{
use ::std::fmt::Write;
use ::core::fmt::Write;
let mut s = $crate::EcoString::new();
::std::write!(s, $($tts)*).unwrap();
::core::write!(s, $($tts)*).unwrap();
s
}};
}
Expand Down
3 changes: 3 additions & 0 deletions src/vendor/vec/splice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use core::ptr;
use core::slice;

#[cfg(not(feature = "std"))]
use alloc::vec::Vec;

use crate::EcoVec;

use super::Drain;
Expand Down
10 changes: 9 additions & 1 deletion tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::mem;
use std::sync::atomic::{AtomicUsize, Ordering::*};

use ecow::string::ToEcoString;
use ecow::{eco_vec, EcoString, EcoVec};
use ecow::{eco_format, eco_vec, EcoString, EcoVec};

const ALPH: &str = "abcdefghijklmnopqrstuvwxyz";
const LIMIT: usize = EcoString::INLINE_LIMIT;
Expand Down Expand Up @@ -371,6 +371,14 @@ fn test_array_from_vec() {
assert_eq!(<[String; 0]>::try_from(EcoVec::new()).unwrap(), <[String; 0]>::default());
}

#[test]
fn test_str_macro() {
assert_eq!(
eco_format!("Hello, {}! The secret number is {}.", "world".to_owned(), 42),
"Hello, world! The secret number is 42."
);
}

#[test]
fn test_str_new() {
// Test inline strings.
Expand Down
Loading