@@ -13,6 +13,7 @@ use libdeflater::{
1313} ;
1414use std:: {
1515 ffi:: OsStr ,
16+ fs:: File ,
1617 io:: Write ,
1718 os:: unix:: ffi:: OsStrExt ,
1819 path:: Path ,
@@ -136,7 +137,7 @@ impl<'a> Command<'a> {
136137 // Write it to a file!
137138 let mut out_file = path. to_path_buf ( ) ;
138139 out_file. push ( self . bin . to_string ( ) + ".bash" ) ;
139- std :: fs :: File :: create ( & out_file)
140+ File :: create ( & out_file)
140141 . and_then ( |mut f| f. write_all ( buf) . and_then ( |_| f. flush ( ) ) )
141142 . map_err ( |_| BashManError :: WriteBash ) ?;
142143
@@ -335,11 +336,10 @@ impl<'a> Command<'a> {
335336 Ok ( ( ) )
336337 }
337338
338- #[ allow( trivial_casts) ]
339339 /// # Write For Real.
340340 fn _write_man ( & self , path : & Path , data : & [ u8 ] ) -> Result < ( ) , BashManError > {
341341 // Write plain.
342- std :: fs :: File :: create ( & path)
342+ File :: create ( & path)
343343 . and_then ( |mut f| f. write_all ( data) . and_then ( |_| f. flush ( ) ) )
344344 . map_err ( |_| BashManError :: WriteSubMan ( Box :: from ( self . bin ) ) ) ?;
345345
@@ -353,10 +353,7 @@ impl<'a> Command<'a> {
353353 buf. truncate ( len) ;
354354
355355 // Toss ".gz" onto the original file path and write again!
356- std:: fs:: File :: create ( OsStr :: from_bytes ( & [
357- unsafe { & * ( path. as_os_str ( ) as * const OsStr as * const [ u8 ] ) } ,
358- b".gz" ,
359- ] . concat ( ) ) )
356+ File :: create ( OsStr :: from_bytes ( & [ path. as_os_str ( ) . as_bytes ( ) , b".gz" ] . concat ( ) ) )
360357 . and_then ( |mut f| f. write_all ( & buf) . and_then ( |_| f. flush ( ) ) )
361358 . map_err ( |_| BashManError :: WriteSubMan ( Box :: from ( self . bin ) ) )
362359 }
0 commit comments