File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
src/tools/rust-analyzer/lib/smol_str Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " smol_str"
3- version = " 0.1.18 "
3+ version = " 0.1.19 "
44description = " small-string optimized string type with O(1) clone"
55license = " MIT OR Apache-2.0"
66repository = " https://github.com/matklad/smol_str"
Original file line number Diff line number Diff line change @@ -6,11 +6,13 @@ extern crate core as std;
66#[ cfg( not( feature = "std" ) ) ]
77extern crate alloc;
88
9+ use core:: convert:: Infallible ;
910use std:: {
1011 borrow:: Borrow ,
1112 cmp:: { self , Ordering } ,
1213 fmt, hash, iter,
1314 ops:: Deref ,
15+ str:: FromStr ,
1416} ;
1517
1618#[ cfg( not( feature = "std" ) ) ]
@@ -316,6 +318,15 @@ impl Borrow<str> for SmolStr {
316318 }
317319}
318320
321+ impl FromStr for SmolStr {
322+ type Err = Infallible ;
323+
324+ #[ inline]
325+ fn from_str ( s : & str ) -> Result < SmolStr , Self :: Err > {
326+ Ok ( SmolStr :: from ( s) )
327+ }
328+ }
329+
319330#[ cfg( feature = "arbitrary" ) ]
320331impl < ' a > arbitrary:: Arbitrary < ' a > for SmolStr {
321332 fn arbitrary ( u : & mut arbitrary:: Unstructured < ' a > ) -> Result < Self , arbitrary:: Error > {
You can’t perform that action at this time.
0 commit comments