File tree 2 files changed +3
-7
lines changed 2 files changed +3
-7
lines changed Original file line number Diff line number Diff line change 10
10
11
11
//! Support code for encoding and decoding types.
12
12
13
- #![ feature( core) ]
13
+ #![ feature( core, convert ) ]
14
14
#![ doc( html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png" ,
15
15
html_favicon_url = "http://www.rust-lang.org/favicon.ico" ,
16
16
html_root_url = "http://doc.rust-lang.org/rustc-serialize/" ) ]
Original file line number Diff line number Diff line change @@ -570,18 +570,14 @@ impl Decodable for path::PathBuf {
570
570
use std:: os:: unix:: prelude:: * ;
571
571
let bytes: Vec < u8 > = try!( Decodable :: decode ( d) ) ;
572
572
let s: OsString = OsStringExt :: from_vec ( bytes) ;
573
- let mut p = path:: PathBuf :: new ( ) ;
574
- p. push ( s) ;
575
- Ok ( p)
573
+ Ok ( path:: PathBuf :: from ( s) )
576
574
}
577
575
#[ cfg( windows) ]
578
576
fn decode < D : Decoder > ( d : & mut D ) -> Result < path:: PathBuf , D :: Error > {
579
577
use std:: os:: windows:: prelude:: * ;
580
578
let bytes: Vec < u16 > = try!( Decodable :: decode ( d) ) ;
581
579
let s: OsString = OsStringExt :: from_wide ( & bytes) ;
582
- let mut p = PathBuf :: new ( ) ;
583
- p. push ( s) ;
584
- Ok ( p)
580
+ Ok ( path:: PathBuf :: from ( s) )
585
581
}
586
582
}
587
583
You can’t perform that action at this time.
0 commit comments