File tree Expand file tree Collapse file tree 1 file changed +2
-11
lines changed
Expand file tree Collapse file tree 1 file changed +2
-11
lines changed Original file line number Diff line number Diff line change 77
88use clap:: { Arg , ArgAction , Command } ;
99use std:: collections:: HashMap ;
10- use std:: path:: { PathBuf , is_separator } ;
10+ use std:: path:: PathBuf ;
1111use uucore:: display:: Quotable ;
1212use uucore:: error:: { UResult , UUsageError } ;
1313use uucore:: format_usage;
@@ -119,17 +119,8 @@ pub fn uu_app() -> Command {
119119}
120120
121121fn basename ( fullname : & str , suffix : & str ) -> String {
122- // Remove all platform-specific path separators from the end.
123- let path = fullname. trim_end_matches ( is_separator) ;
124-
125- // If the path contained *only* suffix characters (for example, if
126- // `fullname` were "///" and `suffix` were "/"), then `path` would
127- // be left with the empty string. In that case, we set `path` to be
128- // the original `fullname` to avoid returning the empty path.
129- let path = if path. is_empty ( ) { fullname } else { path } ;
130-
131122 // Convert to path buffer and get last path component
132- let pb = PathBuf :: from ( path ) ;
123+ let pb = PathBuf :: from ( fullname ) ;
133124
134125 pb. components ( ) . next_back ( ) . map_or_else ( String :: new, |c| {
135126 let name = c. as_os_str ( ) . to_str ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments