Minor fixes

This commit is contained in:
Egor 2024-04-30 11:36:19 +03:00
parent 792536d683
commit 15ce649cdd

View file

@ -43,7 +43,7 @@ fn main() {
dirs.into_iter()
.map(|dir| {
let files_filtered = transform_file_infos(dir.file_infos, &cli);
return dir.name + ":\n" + &format_output(files_filtered, &cli);
format!("{}:\n{}", dir.name, &format_output(files_filtered, &cli))
})
.collect::<Vec<String>>()
.join("\n\n")
@ -83,8 +83,7 @@ fn transform_file_infos(file_infos: Vec<FileInfo>, options: &Cli) -> Vec<String>
// sort alphabetically
filtered_file_infos.sort_by(|fi1, fi2| fi1.name.to_lowercase().cmp(&fi2.name.to_lowercase()));
return filtered_file_infos.into_iter()
.map(|file_info| {
.map(|file_info| {
return format_file_info(file_info, options);
})
.collect();
@ -120,6 +119,7 @@ fn permissions_str(metadata: &Metadata) -> String {
let ftype = metadata.file_type();
let mut result = String::with_capacity(10);
result.push(
// can't match filetype for some reason
if ftype.is_dir() { 'd' }
else if ftype.is_symlink() { 'l' }
else if ftype.is_block_device() { 'b' }