mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Collapse multiple if statements with &&
This commit is contained in:
parent
c23e1db9c5
commit
864215653e
1 changed files with 4 additions and 14 deletions
|
@ -161,20 +161,10 @@ fn is_first_filename_timestamp(
|
|||
) -> bool {
|
||||
match std::env::var("_POSIX2_VERSION") {
|
||||
Ok(s) if s == "199209" => {
|
||||
if timestamp.is_none() && reference.is_none() && date.is_none() {
|
||||
if files.len() >= 2 {
|
||||
if timestamp.is_none() && reference.is_none() && date.is_none() && files.len() >= 2 {
|
||||
let s = files[0];
|
||||
if s.len() == 8 && all_digits(s) {
|
||||
true
|
||||
} else if s.len() == 10 && all_digits(s) {
|
||||
let year = get_year(s);
|
||||
(69..=99).contains(&year)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} else {
|
||||
false
|
||||
}
|
||||
all_digits(s)
|
||||
&& (s.len() == 8 || (s.len() == 10 && (69..=99).contains(&get_year(s))))
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue