File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -753,16 +753,15 @@ impl InteractiveCommand {
753753
754754 /// Expand ~ in path to home directory
755755 fn expand_path ( & self , path : & std:: path:: Path ) -> Result < PathBuf > {
756- if let Some ( path_str) = path. to_str ( ) {
757- if path_str. starts_with ( '~' ) {
758- if let Some ( home) = dirs:: home_dir ( ) {
759- // Handle ~ alone or ~/path
760- if path_str == "~" {
761- return Ok ( home) ;
762- } else if let Some ( rest) = path_str. strip_prefix ( "~/" ) {
763- return Ok ( home. join ( rest) ) ;
764- }
765- }
756+ if let Some ( path_str) = path. to_str ( )
757+ && path_str. starts_with ( '~' )
758+ && let Some ( home) = dirs:: home_dir ( )
759+ {
760+ // Handle ~ alone or ~/path
761+ if path_str == "~" {
762+ return Ok ( home) ;
763+ } else if let Some ( rest) = path_str. strip_prefix ( "~/" ) {
764+ return Ok ( home. join ( rest) ) ;
766765 }
767766 }
768767 Ok ( path. to_path_buf ( ) )
You can’t perform that action at this time.
0 commit comments