mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2026-01-20 17:15:54 +00:00
add From<SmolStr> for String
This commit is contained in:
parent
c6c487ea31
commit
373ca5eda7
@ -136,6 +136,12 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SmolStr> for String {
|
||||
fn from(text: SmolStr) -> Self {
|
||||
text.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
const INLINE_CAP: usize = 22;
|
||||
const N_NEWLINES: usize = 32;
|
||||
const N_SPACES: usize = 128;
|
||||
|
||||
@ -20,6 +20,13 @@ fn assert_traits() {
|
||||
f::<SmolStr>();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn conversions() {
|
||||
let s: SmolStr = "Hello, World!".into();
|
||||
let s: String = s.into();
|
||||
assert_eq!(s, "Hello, World!")
|
||||
}
|
||||
|
||||
fn check_props(s: &str) -> Result<(), proptest::test_runner::TestCaseError> {
|
||||
let smol = SmolStr::new(s);
|
||||
prop_assert_eq!(smol.as_str(), s);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user