mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
Merge pull request #8203 from gabelluardo/add-clippy-rules
Enable some pedantic rules
This commit is contained in:
@@ -657,7 +657,6 @@ needless_pass_by_value = "allow" # 16
|
||||
float_cmp = "allow" # 12
|
||||
items_after_statements = "allow" # 11
|
||||
return_self_not_must_use = "allow" # 8
|
||||
redundant_else = "allow" # 6
|
||||
needless_continue = "allow" # 6
|
||||
inline_always = "allow" # 6
|
||||
fn_params_excessive_bools = "allow" # 6
|
||||
|
||||
@@ -95,12 +95,12 @@ fn parse_group_list(list_str: &str) -> Result<Vec<String>, ChrootError> {
|
||||
if name.is_empty() {
|
||||
// --groups=","
|
||||
continue;
|
||||
} else {
|
||||
// --groups=", "
|
||||
// chroot: invalid group ' '
|
||||
show!(ChrootError::InvalidGroup(name.to_string()));
|
||||
err = true;
|
||||
}
|
||||
|
||||
// --groups=", "
|
||||
// chroot: invalid group ' '
|
||||
show!(ChrootError::InvalidGroup(name.to_string()));
|
||||
err = true;
|
||||
} else {
|
||||
// TODO Figure out a better condition here.
|
||||
if trimmed_name.starts_with(char::is_numeric)
|
||||
|
||||
+3
-3
@@ -2662,10 +2662,10 @@ fn handle_no_preserve_mode(options: &Options, org_mode: u32) -> u32 {
|
||||
const MODE_RW_UGO: u32 =
|
||||
(S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) as u32;
|
||||
const S_IRWXUGO: u32 = (S_IRWXU | S_IRWXG | S_IRWXO) as u32;
|
||||
if is_explicit_no_preserve_mode {
|
||||
return MODE_RW_UGO;
|
||||
return if is_explicit_no_preserve_mode {
|
||||
MODE_RW_UGO
|
||||
} else {
|
||||
return org_mode & S_IRWXUGO;
|
||||
org_mode & S_IRWXUGO
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn obsolete_result(src: &[&str]) -> Option<Result<Vec<String>, ParseError>> {
|
||||
Some(Ok(src.iter().map(|s| (*s).to_string()).collect()))
|
||||
Some(Ok(src.iter().map(|&s| s.to_string()).collect()))
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
+2
-2
@@ -217,9 +217,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
set_exit_code(1);
|
||||
if i + 1 >= users.len() {
|
||||
break;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -916,9 +916,8 @@ fn string_to_control_char(s: &str) -> Result<u8, ControlCharMappingError> {
|
||||
if let Some(val) = ascii_num {
|
||||
if val > 255 {
|
||||
return Err(ControlCharMappingError::IntOutOfRange(s.to_string()));
|
||||
} else {
|
||||
return Ok(val as u8);
|
||||
}
|
||||
return Ok(val as u8);
|
||||
}
|
||||
// try to parse ^<char> or just <char>
|
||||
let mut chars = s.chars();
|
||||
|
||||
@@ -143,9 +143,8 @@ mod platform {
|
||||
get_message("sync-error-find-next-volume"),
|
||||
)),
|
||||
};
|
||||
} else {
|
||||
volumes.push(String::from_wide_null(&name));
|
||||
}
|
||||
volumes.push(String::from_wide_null(&name));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ fn process_utmpx(file: Option<&OsString>) -> (Option<time_t>, usize) {
|
||||
boot_time = Some(dt.unix_timestamp() as time_t);
|
||||
}
|
||||
}
|
||||
_ => continue,
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
(boot_time, nusers)
|
||||
|
||||
Reference in New Issue
Block a user