mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 20:17:45 +00:00
ls: deleting user defined max function (#1591)
This is trivial refactor. ```usize``` can call max method, so deleting user defined max function.
This commit is contained in:
parent
e7a1d13380
commit
19e967ef31
1 changed files with 2 additions and 10 deletions
|
@ -271,14 +271,6 @@ fn sort_entries(entries: &mut Vec<PathBuf>, options: &getopts::Matches) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn max(lhs: usize, rhs: usize) -> usize {
|
|
||||||
if lhs > rhs {
|
|
||||||
lhs
|
|
||||||
} else {
|
|
||||||
rhs
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn should_display(entry: &DirEntry, options: &getopts::Matches) -> bool {
|
fn should_display(entry: &DirEntry, options: &getopts::Matches) -> bool {
|
||||||
let ffi_name = entry.file_name();
|
let ffi_name = entry.file_name();
|
||||||
let name = ffi_name.to_string_lossy();
|
let name = ffi_name.to_string_lossy();
|
||||||
|
@ -350,8 +342,8 @@ fn display_items(items: &[PathBuf], strip: Option<&Path>, options: &getopts::Mat
|
||||||
let (mut max_links, mut max_size) = (1, 1);
|
let (mut max_links, mut max_size) = (1, 1);
|
||||||
for item in items {
|
for item in items {
|
||||||
let (links, size) = display_dir_entry_size(item, options);
|
let (links, size) = display_dir_entry_size(item, options);
|
||||||
max_links = max(links, max_links);
|
max_links = links.max(max_links);
|
||||||
max_size = max(size, max_size);
|
max_size = size.max(max_size);
|
||||||
}
|
}
|
||||||
for item in items {
|
for item in items {
|
||||||
display_item_long(item, strip, max_links, max_size, options);
|
display_item_long(item, strip, max_links, max_size, options);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue