clippy/fmt

This commit is contained in:
epi
2023-03-10 21:10:26 -06:00
parent 771041d225
commit 5d6b85fe12
3 changed files with 11 additions and 6 deletions

View File

@@ -190,7 +190,11 @@ impl Menu {
if value.contains('-') {
// range of two values, needs further processing
let range: Vec<usize> = value.split('-').map(|s| self.str_to_usize(s)).collect();
let range: Vec<usize> = value
.split('-')
.map(|s| self.str_to_usize(s))
.filter(|m| *m != 0)
.collect();
if range.len() != 2 {
// expecting [1, 4] or similar, if a 0 was used, we'd be left with a vec of size 1
@@ -206,6 +210,10 @@ impl Menu {
}
});
} else {
if value.is_empty() {
continue;
}
let value = self.str_to_usize(value);
if !nums.contains(&value) {

View File

@@ -39,6 +39,7 @@ pub struct FeroxScan {
pub scan_type: ScanType,
/// The order in which the scan was received
#[allow(dead_code)] // not entirely sure this isn't used somewhere
pub(crate) scan_order: ScanOrder,
/// Number of requests to populate the progress bar with

View File

@@ -668,11 +668,7 @@ fn menu_get_command_input_from_user_returns_cancel() {
assert!(matches!(result, MenuCmd::Cancel(_, _)));
if let MenuCmd::Cancel(canx_list, ret_force) = result {
if idx == 0 {
assert!(canx_list.is_empty());
} else {
assert_eq!(canx_list, vec![idx]);
}
assert_eq!(canx_list, vec![idx]);
assert_eq!(force, ret_force);
}
}