mirror of
https://github.com/uutils/coreutils
synced 2025-01-19 00:24:13 +00:00
ignore some cognitive_complexity for now
This commit is contained in:
parent
e35d477a8c
commit
f8d7bebed3
46 changed files with 63 additions and 0 deletions
|
@ -47,6 +47,7 @@ fn name(binary_path: &Path) -> Option<&str> {
|
|||
binary_path.file_stem()?.to_str()
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn main() {
|
||||
uucore::panic::mute_sigpipe_panic();
|
||||
|
||||
|
|
|
@ -456,6 +456,7 @@ fn write_fast<R: FdReadable>(handle: &mut InputHandle<R>) -> CatResult<()> {
|
|||
|
||||
/// Outputs file contents to stdout in a line-by-line fashion,
|
||||
/// propagating any errors that might occur.
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn write_lines<R: FdReadable>(
|
||||
handle: &mut InputHandle<R>,
|
||||
options: &OutputOptions,
|
||||
|
|
|
@ -727,6 +727,7 @@ impl Attributes {
|
|||
}
|
||||
|
||||
impl Options {
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn from_matches(matches: &ArgMatches) -> CopyResult<Self> {
|
||||
let not_implemented_opts = vec![
|
||||
#[cfg(not(any(windows, unix)))]
|
||||
|
@ -1467,6 +1468,7 @@ fn aligned_ancestors<'a>(source: &'a Path, dest: &'a Path) -> Vec<(&'a Path, &'a
|
|||
///
|
||||
/// The original permissions of `source` will be copied to `dest`
|
||||
/// after a successful copy.
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn copy_file(
|
||||
progress_bar: &Option<ProgressBar>,
|
||||
source: &Path,
|
||||
|
|
|
@ -356,6 +356,7 @@ impl<'a> SplitWriter<'a> {
|
|||
/// - if no line matched, an [`CsplitError::MatchNotFound`].
|
||||
/// - if there are not enough lines to accommodate the offset, an
|
||||
/// [`CsplitError::LineOutOfRange`].
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn do_to_match<I>(
|
||||
&mut self,
|
||||
pattern_as_str: &str,
|
||||
|
|
|
@ -141,6 +141,7 @@ impl<'a> From<&'a str> for Rfc3339Format {
|
|||
}
|
||||
|
||||
#[uucore::main]
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let matches = uu_app().try_get_matches_from(args)?;
|
||||
|
||||
|
|
|
@ -752,6 +752,7 @@ fn finalize<T>(
|
|||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn make_linux_oflags(oflags: &OFlags) -> Option<libc::c_int> {
|
||||
let mut flag = 0;
|
||||
|
||||
|
|
|
@ -293,6 +293,7 @@ impl Parser {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn parse_input_flags(&mut self, val: &str) -> Result<(), ParseError> {
|
||||
let mut i = &mut self.iflag;
|
||||
for f in val.split(',') {
|
||||
|
@ -324,6 +325,7 @@ impl Parser {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn parse_output_flags(&mut self, val: &str) -> Result<(), ParseError> {
|
||||
let mut o = &mut self.oflag;
|
||||
for f in val.split(',') {
|
||||
|
|
|
@ -284,6 +284,7 @@ enum ParseState {
|
|||
use std::collections::HashMap;
|
||||
use uucore::{format_usage, parse_glob};
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn parse<T>(lines: T, fmt: &OutputFmt, fp: &str) -> Result<String, String>
|
||||
where
|
||||
T: IntoIterator,
|
||||
|
|
|
@ -289,6 +289,7 @@ fn choose_size(matches: &ArgMatches, stat: &Stat) -> u64 {
|
|||
|
||||
// this takes `my_stat` to avoid having to stat files multiple times.
|
||||
// XXX: this should use the impl Trait return type when it is stabilized
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn du(
|
||||
mut my_stat: Stat,
|
||||
options: &Options,
|
||||
|
@ -521,6 +522,7 @@ fn build_exclude_patterns(matches: &ArgMatches) -> UResult<Vec<Pattern>> {
|
|||
}
|
||||
|
||||
#[uucore::main]
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let args = args.collect_ignore();
|
||||
|
||||
|
|
1
src/uu/env/src/env.rs
vendored
1
src/uu/env/src/env.rs
vendored
|
@ -175,6 +175,7 @@ pub fn uu_app() -> Command {
|
|||
.arg(Arg::new("vars").action(ArgAction::Append))
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn run_env(args: impl uucore::Args) -> UResult<()> {
|
||||
let app = uu_app();
|
||||
let matches = app.try_get_matches_from(args).with_exit_code(125)?;
|
||||
|
|
|
@ -373,6 +373,7 @@ enum CharType {
|
|||
Other,
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn expand(options: &Options) -> std::io::Result<()> {
|
||||
use self::CharType::*;
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ pub struct FmtOptions {
|
|||
/// # Returns
|
||||
///
|
||||
/// A tuple containing a vector of file names and a `FmtOptions` struct.
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn parse_arguments(args: impl uucore::Args) -> UResult<(Vec<String>, FmtOptions)> {
|
||||
let matches = uu_app().try_get_matches_from(args)?;
|
||||
|
||||
|
|
|
@ -223,6 +223,7 @@ struct LineBreak<'a> {
|
|||
fresh: bool,
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn find_kp_breakpoints<'a, T: Iterator<Item = &'a WordInfo<'a>>>(
|
||||
iter: T,
|
||||
args: &BreakArgs<'a>,
|
||||
|
|
|
@ -275,6 +275,7 @@ impl<'a> ParagraphStream<'a> {
|
|||
impl<'a> Iterator for ParagraphStream<'a> {
|
||||
type Item = Result<Paragraph, String>;
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn next(&mut self) -> Option<Result<Paragraph, String>> {
|
||||
// return a NoFormatLine in an Err; it should immediately be output
|
||||
let noformat = match self.lines.peek() {
|
||||
|
|
|
@ -207,6 +207,7 @@ fn fold_file_bytewise<T: Read>(mut file: BufReader<T>, spaces: bool, width: usiz
|
|||
///
|
||||
/// If `spaces` is `true`, attempt to break lines at whitespace boundaries.
|
||||
#[allow(unused_assignments)]
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn fold_file<T: Read>(mut file: BufReader<T>, spaces: bool, width: usize) -> UResult<()> {
|
||||
let mut line = String::new();
|
||||
let mut output = String::new();
|
||||
|
|
|
@ -224,6 +224,7 @@ fn detect_algo(
|
|||
/// # Panics
|
||||
///
|
||||
/// Panics if multiple hash algorithms are specified or if a required flag is missing.
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn create_algorithm_from_flags(matches: &ArgMatches) -> (&'static str, Box<dyn Digest>, usize) {
|
||||
let mut alg: Option<Box<dyn Digest>> = None;
|
||||
let mut name: &'static str = "";
|
||||
|
|
|
@ -432,6 +432,7 @@ fn head_file(input: &mut std::fs::File, options: &HeadOptions) -> std::io::Resul
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn uu_head(options: &HeadOptions) -> UResult<()> {
|
||||
let mut first = true;
|
||||
for file in &options.files {
|
||||
|
|
|
@ -13,6 +13,7 @@ pub enum ParseError {
|
|||
}
|
||||
/// Parses obsolete syntax
|
||||
/// head -NUM\[kmzv\] // spell-checker:disable-line
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn parse_obsolete(src: &str) -> Option<Result<impl Iterator<Item = OsString>, ParseError>> {
|
||||
let mut chars = src.char_indices();
|
||||
if let Some((_, '-')) = chars.next() {
|
||||
|
|
|
@ -600,6 +600,7 @@ impl<'a> State<'a> {
|
|||
}
|
||||
|
||||
#[uucore::main]
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let matches = uu_app().try_get_matches_from(args)?;
|
||||
|
||||
|
|
|
@ -292,6 +292,7 @@ fn exec(files: &[PathBuf], settings: &Settings) -> UResult<()> {
|
|||
link(&files[0], &files[1], settings)
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings) -> UResult<()> {
|
||||
if !target_dir.is_dir() {
|
||||
return Err(LnError::TargetIsDirectory(target_dir.to_owned()).into());
|
||||
|
@ -364,6 +365,7 @@ fn relative_path<'a>(src: &'a Path, dst: &Path) -> Cow<'a, Path> {
|
|||
src.into()
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn link(src: &Path, dst: &Path, settings: &Settings) -> UResult<()> {
|
||||
let mut backup_path = None;
|
||||
let source: Cow<'_, Path> = if settings.relative {
|
||||
|
|
|
@ -650,6 +650,7 @@ fn extract_indicator_style(options: &clap::ArgMatches) -> IndicatorStyle {
|
|||
}
|
||||
|
||||
impl Config {
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn from(options: &clap::ArgMatches) -> UResult<Self> {
|
||||
let context = options.get_flag(options::CONTEXT);
|
||||
let (mut format, opt) = extract_format(options);
|
||||
|
@ -1997,6 +1998,7 @@ fn should_display(entry: &DirEntry, config: &Config) -> bool {
|
|||
.any(|p| p.matches_with(&file_name, options))
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn enter_directory(
|
||||
path_data: &PathData,
|
||||
read_dir: ReadDir,
|
||||
|
@ -2187,6 +2189,7 @@ fn display_additional_leading_info(
|
|||
Ok(result)
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn display_items(items: &[PathData], config: &Config, out: &mut BufWriter<Stdout>) -> UResult<()> {
|
||||
// `-Z`, `--context`:
|
||||
// Display the SELinux security context or '?' if none is found. When used with the `-l`
|
||||
|
@ -2376,6 +2379,7 @@ fn display_grid(
|
|||
/// ```
|
||||
/// that decide the maximum possible character count of each field.
|
||||
#[allow(clippy::write_literal)]
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn display_item_long(
|
||||
item: &PathData,
|
||||
padding: &PaddingCollection,
|
||||
|
@ -2806,6 +2810,7 @@ fn classify_file(path: &PathData, out: &mut BufWriter<Stdout>) -> Option<char> {
|
|||
/// Note that non-unicode sequences in symlink targets are dealt with using
|
||||
/// [`std::path::Path::to_string_lossy`].
|
||||
#[allow(unused_variables)]
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn display_file_name(
|
||||
path: &PathData,
|
||||
config: &Config,
|
||||
|
|
|
@ -321,6 +321,7 @@ fn exec(files: &[OsString], b: &Behavior) -> UResult<()> {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> UResult<()> {
|
||||
if !target_dir.is_dir() {
|
||||
return Err(MvError::NotADirectory(target_dir.quote().to_string()).into());
|
||||
|
|
|
@ -25,6 +25,7 @@ fn parse_style(chars: &[char]) -> Result<crate::NumberingStyle, String> {
|
|||
|
||||
// parse_options loads the options into the settings, returning an array of
|
||||
// error messages.
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> Vec<String> {
|
||||
// This vector holds error messages encountered.
|
||||
let mut errs: Vec<String> = vec![];
|
||||
|
|
|
@ -236,6 +236,7 @@ pub fn uu_app() -> Command {
|
|||
}
|
||||
|
||||
// nl implements the main functionality for an individual buffer.
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn nl<T: Read>(reader: &mut BufReader<T>, settings: &Settings) -> UResult<()> {
|
||||
let regexp: regex::Regex = regex::Regex::new(r".?").unwrap();
|
||||
let mut line_no = settings.starting_line_number;
|
||||
|
|
|
@ -95,6 +95,7 @@ impl FromStr for FormatOptions {
|
|||
// An optional zero (%010f) will zero pad the number.
|
||||
// An optional negative value (%-10f) will left align.
|
||||
// An optional precision (%.1f) determines the precision of the number.
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let mut iter = s.chars().peekable();
|
||||
let mut options = Self::default();
|
||||
|
|
|
@ -96,6 +96,7 @@ fn od_argument_with_option(ch: char) -> bool {
|
|||
/// arguments with parameters like -w16 can only appear at the end: -fvoxw16
|
||||
/// parameters of -t/--format specify 1 or more formats.
|
||||
/// if -- appears on the command line, parsing should stop.
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn parse_format_flags(args: &[String]) -> Result<Vec<ParsedFormatterItemInfo>, String> {
|
||||
let mut formats = Vec::new();
|
||||
|
||||
|
|
|
@ -111,6 +111,7 @@ pub fn uu_app() -> Command {
|
|||
)
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn paste(
|
||||
filenames: Vec<String>,
|
||||
serial: bool,
|
||||
|
|
|
@ -488,6 +488,7 @@ fn parse_usize(matches: &ArgMatches, opt: &str) -> Option<Result<usize, PrError>
|
|||
.map(from_parse_error_to_pr_error)
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn build_options(
|
||||
matches: &ArgMatches,
|
||||
paths: &[&str],
|
||||
|
@ -1021,6 +1022,7 @@ fn print_page(
|
|||
Ok(lines_written)
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn write_columns(
|
||||
lines: &[FileLine],
|
||||
options: &OutputOptions,
|
||||
|
|
|
@ -107,6 +107,7 @@ struct WordFilter {
|
|||
}
|
||||
|
||||
impl WordFilter {
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn new(matches: &clap::ArgMatches, config: &Config) -> UResult<Self> {
|
||||
let (o, oset): (bool, HashSet<String>) = if matches.contains_id(options::ONLY_FILE) {
|
||||
let words =
|
||||
|
|
|
@ -274,6 +274,7 @@ fn remove(files: &[String], options: &Options) -> bool {
|
|||
had_err
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn handle_dir(path: &Path, options: &Options) -> bool {
|
||||
let mut had_err = false;
|
||||
|
||||
|
@ -422,6 +423,7 @@ fn remove_file(path: &Path, options: &Options) -> bool {
|
|||
false
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn prompt_file(path: &Path, options: &Options, is_dir: bool) -> bool {
|
||||
// If interactive is Never we never want to send prompts
|
||||
if options.interactive == InteractiveMode::Never {
|
||||
|
|
|
@ -361,6 +361,7 @@ fn pass_name(pass_type: &PassType) -> String {
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn wipe_file(
|
||||
path_str: &str,
|
||||
n_passes: usize,
|
||||
|
|
|
@ -52,6 +52,7 @@ impl NumInfo {
|
|||
/// an empty range (idx..idx) is returned so that idx is the char after the last zero.
|
||||
/// If the input is not a number (which has to be treated as zero), the returned empty range
|
||||
/// will be 0..0.
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn parse(num: &str, parse_settings: &NumInfoParseSettings) -> (Self, Range<usize>) {
|
||||
let mut exponent = -1;
|
||||
let mut had_decimal_pt = false;
|
||||
|
|
|
@ -1033,6 +1033,7 @@ fn make_sort_mode_arg(mode: &'static str, short: char, help: &'static str) -> Ar
|
|||
}
|
||||
|
||||
#[uucore::main]
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let args = args.collect_ignore();
|
||||
let mut settings = GlobalSettings::default();
|
||||
|
@ -1654,6 +1655,7 @@ fn compare_by<'a>(
|
|||
// In contrast to numeric compare, GNU general numeric/FP sort *should* recognize positive signs and
|
||||
// scientific notation, so we strip those lines only after the end of the following numeric string.
|
||||
// For example, 5e10KFD would be 5e10 or 5x10^10 and +10000HFKJFK would become 10000.
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn get_leading_gen(input: &str) -> Range<usize> {
|
||||
let trimmed = input.trim_start();
|
||||
let leading_whitespace_len = input.len() - trimmed.len();
|
||||
|
|
|
@ -222,6 +222,7 @@ fn buffer_tac(data: &[u8], before: bool, separator: &str) -> std::io::Result<()>
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn tac(filenames: &[&str], before: bool, regex: bool, separator: &str) -> UResult<()> {
|
||||
// Compile the regular expression pattern if it is provided.
|
||||
let maybe_pattern = if regex {
|
||||
|
|
|
@ -303,6 +303,7 @@ impl Observer {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn handle_event(
|
||||
&mut self,
|
||||
event: ¬ify::Event,
|
||||
|
@ -471,6 +472,7 @@ impl Observer {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn follow(mut observer: Observer, settings: &Settings) -> UResult<()> {
|
||||
if observer.files.no_files_remaining(settings) && !observer.files.only_stdin_remaining() {
|
||||
return Err(USimpleError::new(1, text::NO_FILES_REMAINING.to_string()));
|
||||
|
|
|
@ -65,6 +65,7 @@ fn dt_to_filename(tm: time::PrimitiveDateTime) -> FileTime {
|
|||
}
|
||||
|
||||
#[uucore::main]
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let matches = uu_app().try_get_matches_from(args)?;
|
||||
|
||||
|
|
|
@ -318,6 +318,7 @@ fn next_char_info(uflag: bool, buf: &[u8], byte: usize) -> (CharType, usize, usi
|
|||
(ctype, cwidth, nbytes)
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn unexpand(options: &Options) -> std::io::Result<()> {
|
||||
let mut output = BufWriter::new(stdout());
|
||||
let ts = &options.tabstops[..];
|
||||
|
|
|
@ -60,6 +60,7 @@ impl<B: BufRead> BufReadDecoder<B> {
|
|||
/// This is similar to `Iterator::next`,
|
||||
/// except that decoded chunks borrow the decoder (~iterator)
|
||||
/// so they need to be handled or copied before the next chunk can start decoding.
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn next_strict(&mut self) -> Option<Result<&str, BufReadDecoderError>> {
|
||||
enum BytesSource {
|
||||
BufRead(usize),
|
||||
|
|
|
@ -450,6 +450,7 @@ fn word_count_from_reader<T: WordCountable>(
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn word_count_from_reader_specialized<
|
||||
T: WordCountable,
|
||||
const SHOW_CHARS: bool,
|
||||
|
|
|
@ -326,6 +326,7 @@ impl<'a> From<Component<'a>> for OwningComponent {
|
|||
/// * [`ResolveMode::Logical`] makes this function resolve '..' components
|
||||
/// before symlinks
|
||||
///
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn canonicalize<P: AsRef<Path>>(
|
||||
original: P,
|
||||
miss_mode: MissingHandling,
|
||||
|
@ -457,6 +458,7 @@ pub fn display_permissions(metadata: &fs::Metadata, display_file_type: bool) ->
|
|||
|
||||
// The logic below is more readable written this way.
|
||||
#[allow(clippy::if_not_else)]
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
#[cfg(unix)]
|
||||
/// Display the permissions of a file on a unix like system
|
||||
pub fn display_permissions_unix(mode: mode_t, display_file_type: bool) -> String {
|
||||
|
|
|
@ -203,6 +203,7 @@ impl ChownExecutor {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn traverse<P: AsRef<Path>>(&self, root: P) -> i32 {
|
||||
let path = root.as_ref();
|
||||
let meta = match self.obtain_meta(path, self.dereference) {
|
||||
|
@ -270,6 +271,7 @@ impl ChownExecutor {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn dive_into<P: AsRef<Path>>(&self, root: P) -> i32 {
|
||||
let root = root.as_ref();
|
||||
|
||||
|
@ -421,6 +423,7 @@ type GidUidFilterParser = fn(&ArgMatches) -> UResult<(Option<u32>, Option<u32>,
|
|||
/// `parse_gid_uid_and_filter` will be called to obtain the target gid and uid, and the filter,
|
||||
/// from `ArgMatches`.
|
||||
/// `groups_only` determines whether verbose output will only mention the group.
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn chown_base(
|
||||
mut command: Command,
|
||||
args: impl crate::Args,
|
||||
|
|
|
@ -40,6 +40,7 @@ fn has_enough_digits(
|
|||
}
|
||||
|
||||
impl FloatAnalysis {
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn analyze(
|
||||
str_in: &str,
|
||||
initial_prefix: &InitialPrefix,
|
||||
|
@ -219,6 +220,7 @@ fn round_terminal_digit(
|
|||
(before_dec, after_dec, false)
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn get_primitive_dec(
|
||||
initial_prefix: &InitialPrefix,
|
||||
str_in: &str,
|
||||
|
|
|
@ -40,6 +40,7 @@ impl Intf {
|
|||
// is_zero: true if number is zero, false otherwise
|
||||
// len_digits: length of digits used to create the int
|
||||
// important, for example, if we run into a non-valid character
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn analyze(str_in: &str, signed_out: bool, initial_prefix: &InitialPrefix) -> IntAnalysis {
|
||||
// the maximum number of digits we could conceivably
|
||||
// have before the decimal point without exceeding the
|
||||
|
|
|
@ -87,6 +87,7 @@ fn get_provided(str_in_opt: Option<&String>) -> Option<u8> {
|
|||
// a base,
|
||||
// and an offset for index after all
|
||||
// initial spacing, sign, base prefix, and leading zeroes
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn get_initial_prefix(str_in: &str, field_type: &FieldType) -> InitialPrefix {
|
||||
let mut str_it = str_in.chars();
|
||||
let mut ret = InitialPrefix {
|
||||
|
|
|
@ -173,6 +173,7 @@ impl SubParser {
|
|||
prefix_char,
|
||||
))
|
||||
}
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn sub_vals_retrieved(&mut self, it: &mut PutBackN<Chars>) -> UResult<bool> {
|
||||
if !Self::successfully_eat_prefix(it, &mut self.text_so_far)? {
|
||||
return Ok(false);
|
||||
|
@ -342,6 +343,7 @@ impl SubParser {
|
|||
}
|
||||
|
||||
impl Sub {
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub(crate) fn write<W>(&self, writer: &mut W, pf_args_it: &mut Peekable<Iter<String>>)
|
||||
where
|
||||
W: Write,
|
||||
|
|
|
@ -197,6 +197,7 @@ impl UnescapedText {
|
|||
// and return a wrapper around a Vec<u8> of unescaped bytes
|
||||
// break on encounter of sub symbol ('%[^%]') unless called
|
||||
// through %b subst.
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn from_it_core<W>(
|
||||
writer: &mut W,
|
||||
it: &mut PutBackN<Chars>,
|
||||
|
|
Loading…
Reference in a new issue