File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ use std::iter::Peekable;
14
14
pub fn scan_str_lit ( lit : & Literal ) -> TokenStream {
15
15
let s = lit. to_string ( ) ;
16
16
if !s. starts_with ( '\"' ) {
17
- return quote ! ( :: cmd_lib:: CmdString :: default ( ) . append ( & #lit) ) ;
17
+ return quote ! ( :: cmd_lib:: CmdString :: from ( & #lit) ) ;
18
18
}
19
19
let mut iter = s[ 1 ..s. len ( ) - 1 ] // To trim outside ""
20
20
. chars ( )
Original file line number Diff line number Diff line change @@ -541,7 +541,7 @@ pub trait AsOsStr {
541
541
542
542
impl < T : ToString > AsOsStr for T {
543
543
fn as_os_str ( & self ) -> OsString {
544
- OsString :: from ( self . to_string ( ) )
544
+ self . to_string ( ) . into ( )
545
545
}
546
546
}
547
547
@@ -559,9 +559,16 @@ impl CmdString {
559
559
}
560
560
561
561
pub fn into_path_buf ( self ) -> PathBuf {
562
- PathBuf :: from ( self . 0 )
562
+ self . 0 . into ( )
563
563
}
564
564
}
565
+
566
+ impl < T : ?Sized + AsRef < OsStr > > From < & T > for CmdString {
567
+ fn from ( s : & T ) -> Self {
568
+ Self ( s. as_ref ( ) . into ( ) )
569
+ }
570
+ }
571
+
565
572
impl fmt:: Display for CmdString {
566
573
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
567
574
f. write_str ( & self . 0 . to_string_lossy ( ) )
You can’t perform that action at this time.
0 commit comments