44 clippy:: indexing_slicing,
55 clippy:: panic
66) ]
7+ use std:: env;
78use std:: io:: Read ;
89use std:: path:: { Path , PathBuf } ;
910
@@ -320,7 +321,7 @@ pub fn parse(file: &str, host: &str) -> Result<Config, Error> {
320321}
321322
322323pub fn parse_home ( host : & str ) -> Result < Config , Error > {
323- let mut home = if let Some ( home) = home :: home_dir ( ) {
324+ let mut home = if let Some ( home) = env :: home_dir ( ) {
324325 home
325326 } else {
326327 return Err ( Error :: NoHome ) ;
@@ -373,7 +374,7 @@ impl SshConfigStrExt for &str {
373374
374375 fn expand_home ( & self ) -> Result < PathBuf , Error > {
375376 if self . starts_with ( "~/" ) {
376- if let Some ( mut home) = home :: home_dir ( ) {
377+ if let Some ( mut home) = env :: home_dir ( ) {
377378 home. push ( self . split_at ( 2 ) . 1 ) ;
378379 Ok ( home)
379380 } else {
@@ -388,6 +389,7 @@ impl SshConfigStrExt for &str {
388389#[ cfg( test) ]
389390mod tests {
390391 #![ allow( clippy:: expect_used) ]
392+ use std:: env;
391393 use std:: path:: { Path , PathBuf } ;
392394
393395 use crate :: { AddKeysToAgent , Config , Error , SshConfigStrExt , parse} ;
@@ -420,7 +422,7 @@ mod tests {
420422 assert_eq ! (
421423 format!(
422424 "{}{}" ,
423- home :: home_dir( ) . expect( "homedir" ) . to_str( ) . expect( "to_str" ) ,
425+ env :: home_dir( ) . expect( "homedir" ) . to_str( ) . expect( "to_str" ) ,
424426 "/some/folder"
425427 ) ,
426428 value. to_str( ) . unwrap( )
@@ -455,7 +457,7 @@ Host test_host
455457#" ;
456458 let identity_file = PathBuf :: from ( format ! (
457459 "{}{}" ,
458- home :: home_dir( ) . expect( "homedir" ) . to_str( ) . expect( "to_str" ) ,
460+ env :: home_dir( ) . expect( "homedir" ) . to_str( ) . expect( "to_str" ) ,
459461 "/.ssh/id_ed25519"
460462 ) ) ;
461463 let config = parse ( value, "test_host" ) . expect ( "parse" ) ;
0 commit comments