mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
Rust format
This commit is contained in:
+9
-4
@@ -55,21 +55,26 @@ fn main() {
|
|||||||
|
|
||||||
let number_of_lines = match value_t!(options.value_of("number_of_lines"), usize) {
|
let number_of_lines = match value_t!(options.value_of("number_of_lines"), usize) {
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(_) => { eprintln!("Bad value for number_of_lines - ignoring"); DEFAULT_NUMBER_OF_LINES}
|
Err(_) => {
|
||||||
|
eprintln!("Bad value for number_of_lines - ignoring");
|
||||||
|
DEFAULT_NUMBER_OF_LINES
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let depth = {
|
let depth = {
|
||||||
if options.is_present("depth") {
|
if options.is_present("depth") {
|
||||||
match value_t!(options.value_of("depth"), u64) {
|
match value_t!(options.value_of("depth"), u64) {
|
||||||
Ok(v) => Some(v + 1),
|
Ok(v) => Some(v + 1),
|
||||||
Err(_) => { eprintln!("Bad value for depth - ignoring"); None},
|
Err(_) => {
|
||||||
|
eprintln!("Bad value for depth - ignoring");
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if options.is_present("depth") && number_of_lines != DEFAULT_NUMBER_OF_LINES
|
if options.is_present("depth") && number_of_lines != DEFAULT_NUMBER_OF_LINES {
|
||||||
{
|
|
||||||
eprintln!("Use either -n or -d. Not both");
|
eprintln!("Use either -n or -d. Not both");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
|
use std::cmp::Ordering;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::cmp::Ordering;
|
|
||||||
|
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ fn examine_dir(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn compare_tuple(a :&(String, u64), b: &(String, u64)) -> Ordering {
|
pub fn compare_tuple(a: &(String, u64), b: &(String, u64)) -> Ordering {
|
||||||
let result = b.1.cmp(&a.1);
|
let result = b.1.cmp(&a.1);
|
||||||
if result == Ordering::Equal {
|
if result == Ordering::Equal {
|
||||||
a.0.cmp(&b.0)
|
a.0.cmp(&b.0)
|
||||||
|
|||||||
@@ -21,7 +21,5 @@ pub fn get_metadata(d: &DirEntry, use_apparent_size: bool) -> Option<(u64, Optio
|
|||||||
|
|
||||||
#[cfg(not(target_family = "unix"))]
|
#[cfg(not(target_family = "unix"))]
|
||||||
pub fn get_metadata(d: &DirEntry, _apparent: bool) -> Option<(u64, Option<(u64, u64)>)> {
|
pub fn get_metadata(d: &DirEntry, _apparent: bool) -> Option<(u64, Option<(u64, u64)>)> {
|
||||||
d.metadata().ok().map_or(None, |md| {
|
d.metadata().ok().map_or(None, |md| Some((md.len(), None)))
|
||||||
Some((md.len(), None))
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user