mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-04 15:07:47 +00:00
refactor/polish ~ fix cargo clippy
complaints (allow complexity)
This commit is contained in:
parent
37c9b0e331
commit
5094d6ffcc
8 changed files with 11 additions and 0 deletions
|
@ -203,6 +203,7 @@ fn cut_bytes<R: Read>(reader: R, ranges: &[Range], opts: &Options) -> i32 {
|
|||
0
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn cut_fields_delimiter<R: Read>(
|
||||
reader: R,
|
||||
ranges: &[Range],
|
||||
|
@ -288,6 +289,7 @@ fn cut_fields_delimiter<R: Read>(
|
|||
0
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn cut_fields<R: Read>(reader: R, ranges: &[Range], opts: &FieldOptions) -> i32 {
|
||||
let newline_char = if opts.zero_terminated { b'\0' } else { b'\n' };
|
||||
if let Some(ref o_delim) = opts.out_delimeter {
|
||||
|
|
|
@ -227,6 +227,7 @@ fn convert_size_other(size: u64, _multiplier: u64, block_size: u64) -> String {
|
|||
format!("{}", ((size as f64) / (block_size as f64)).ceil())
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let syntax = format!(
|
||||
"[OPTION]... [FILE]...
|
||||
|
|
|
@ -57,6 +57,7 @@ pub struct FmtOptions {
|
|||
tabwidth: usize,
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
.optflag("c", "crown-margin", "First and second line of paragraph may have different indentations, in which case the first line's indentation is preserved, and each subsequent line's indentation matches the second line.")
|
||||
|
|
|
@ -48,6 +48,7 @@ fn is_custom_binary(program: &str) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn detect_algo(
|
||||
program: &str,
|
||||
matches: &getopts::Matches,
|
||||
|
@ -367,6 +368,8 @@ Compute and check message digests.",
|
|||
print!("{}", opts.usage(&msg));
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn hashsum(
|
||||
algoname: &str,
|
||||
mut digest: Box<dyn Digest>,
|
||||
|
|
|
@ -599,6 +599,7 @@ macro_rules! has {
|
|||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn display_file_name(
|
||||
path: &Path,
|
||||
strip: Option<&Path>,
|
||||
|
|
|
@ -45,6 +45,7 @@ fn _makenod(path: CString, mode: mode_t, dev: dev_t) -> i32 {
|
|||
unsafe { libc::mknod(path.as_ptr(), mode, dev) }
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let mut opts = Options::new();
|
||||
|
||||
|
|
|
@ -209,6 +209,7 @@ pub struct Stater {
|
|||
default_dev_tokens: Vec<Token>,
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn print_it(arg: &str, otype: OutputType, flag: u8, width: usize, precision: i32) {
|
||||
// If the precision is given as just '.', the precision is taken to be zero.
|
||||
// A negative precision is taken as if the precision were omitted.
|
||||
|
|
|
@ -57,6 +57,7 @@ impl Default for Settings {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let mut settings: Settings = Default::default();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue