mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 11:07:44 +00:00
Fix some clippy warnings
This commit is contained in:
parent
6734ce785d
commit
dcbcf01665
9 changed files with 14 additions and 13 deletions
|
@ -147,7 +147,7 @@ fn cksum(fname: &str) -> io::Result<(u32, usize)> {
|
|||
"Is a directory",
|
||||
));
|
||||
};
|
||||
if !path.metadata().is_ok() {
|
||||
if path.metadata().is_err() {
|
||||
return Err(std::io::Error::new(
|
||||
io::ErrorKind::NotFound,
|
||||
"No such file or directory",
|
||||
|
|
|
@ -81,7 +81,7 @@ pub fn break_lines(para: &Paragraph, opts: &FmtOptions, ostream: &mut BufWriter<
|
|||
let mut break_args = BreakArgs {
|
||||
opts,
|
||||
init_len: p_init_len,
|
||||
indent_str: &p_indent[..],
|
||||
indent_str: p_indent,
|
||||
indent_len: p_indent_len,
|
||||
uniform,
|
||||
ostream,
|
||||
|
|
|
@ -223,7 +223,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
} else if matches.is_present(OPT_BACKUP) {
|
||||
match matches.value_of(OPT_BACKUP) {
|
||||
None => BackupMode::ExistingBackup,
|
||||
Some(mode) => match &mode[..] {
|
||||
Some(mode) => match mode {
|
||||
"simple" | "never" => BackupMode::SimpleBackup,
|
||||
"numbered" | "t" => BackupMode::NumberedBackup,
|
||||
"existing" | "nil" => BackupMode::ExistingBackup,
|
||||
|
|
|
@ -270,11 +270,9 @@ impl Config {
|
|||
.any(|i| i >= idx)
|
||||
{
|
||||
format = Format::Long;
|
||||
} else {
|
||||
if let Some(mut indices) = options.indices_of(options::format::ONELINE) {
|
||||
if indices.any(|i| i > idx) {
|
||||
format = Format::OneLine;
|
||||
}
|
||||
} else if let Some(mut indices) = options.indices_of(options::format::ONELINE) {
|
||||
if indices.any(|i| i > idx) {
|
||||
format = Format::OneLine;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) ->
|
|||
}
|
||||
match opts.value_of(options::NUMBER_FORMAT) {
|
||||
None => {}
|
||||
Some(val) => match val.as_ref() {
|
||||
Some(val) => match val {
|
||||
"ln" => {
|
||||
settings.number_format = crate::NumberFormat::Left;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ fn get_primitive_hex(
|
|||
// assign 0
|
||||
let (mut first_segment_raw, second_segment_raw) = match analysis.decimal_pos {
|
||||
Some(pos) => (&str_in[..pos], &str_in[pos + 1..]),
|
||||
None => (&str_in[..], "0"),
|
||||
None => (str_in, "0"),
|
||||
};
|
||||
if first_segment_raw.is_empty() {
|
||||
first_segment_raw = "0";
|
||||
|
|
|
@ -218,7 +218,7 @@ pub fn get_primitive_dec(
|
|||
// assign 0
|
||||
let (mut first_segment_raw, second_segment_raw) = match analysis.decimal_pos {
|
||||
Some(pos) => (&str_in[..pos], &str_in[pos + 1..]),
|
||||
None => (&str_in[..], "0"),
|
||||
None => (str_in, "0"),
|
||||
};
|
||||
if first_segment_raw.is_empty() {
|
||||
first_segment_raw = "0";
|
||||
|
|
|
@ -338,7 +338,7 @@ this is the default for non-regular files",
|
|||
Some(s) => match s.parse::<usize>() {
|
||||
Ok(u) => u,
|
||||
Err(_) => {
|
||||
errs.push(String::from(format!("invalid number of passes: '{}'", s)));
|
||||
errs.push(format!("invalid number of passes: '{}'", s));
|
||||
0
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
#[cfg(not(windows))]
|
||||
use libc;
|
||||
use std::env;
|
||||
use std::ffi::{CString, OsStr};
|
||||
#[cfg(not(windows))]
|
||||
use std::ffi::CString;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs::{self, File, OpenOptions};
|
||||
use std::io::{Read, Result, Write};
|
||||
#[cfg(unix)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue