mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-04 23:17:46 +00:00
Fix clippy warnings
This commit is contained in:
parent
ce733b38a9
commit
0a3a2ca935
4 changed files with 5 additions and 5 deletions
|
@ -109,7 +109,7 @@ extern {
|
|||
pub fn getgroupcount(name: *const c_char, gid: gid_t) -> int32_t;
|
||||
}
|
||||
|
||||
pub fn get_pw_from_args(free: &Vec<String>) -> Option<c_passwd> {
|
||||
pub fn get_pw_from_args(free: &[String]) -> Option<c_passwd> {
|
||||
if free.len() == 1 {
|
||||
let username = &free[0][..];
|
||||
|
||||
|
@ -219,7 +219,7 @@ pub fn group(possible_pw: Option<c_passwd>, nflag: bool) {
|
|||
Err(errno) =>
|
||||
crash!(1, "failed to get group list (errno={})", errno),
|
||||
Ok(groups) => {
|
||||
for &g in groups.iter() {
|
||||
for &g in &groups {
|
||||
if nflag {
|
||||
let group = unsafe { getgrgid(g) };
|
||||
if !group.is_null() {
|
||||
|
|
|
@ -82,7 +82,7 @@ pub fn canonicalize<P: AsRef<Path>>(original: P, can_mode: CanonicalizeMode) ->
|
|||
}
|
||||
|
||||
// Resolve the symlinks where possible
|
||||
if parts.len() > 0 {
|
||||
if !parts.is_empty() {
|
||||
for part in parts[..parts.len()-1].iter() {
|
||||
result.push(part);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
pub fn from_str(string: &str) -> Result<f64, String> {
|
||||
let len = string.len();
|
||||
if len == 0 {
|
||||
return Err("empty string".to_string())
|
||||
return Err("empty string".to_owned())
|
||||
}
|
||||
let slice = &string[..len - 1];
|
||||
let (numstr, times) = match string.chars().next_back().unwrap() {
|
||||
|
|
|
@ -141,7 +141,7 @@ pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option<usize> {
|
|||
if signal_name_or_value == "0" {
|
||||
return Some(0);
|
||||
}
|
||||
for signal in ALL_SIGNALS.iter() {
|
||||
for signal in &ALL_SIGNALS {
|
||||
let long_name = format!("SIG{}", signal.name);
|
||||
if signal.name == signal_name_or_value || (signal_name_or_value == signal.value.to_string()) || (long_name == signal_name_or_value) {
|
||||
return Some(signal.value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue