mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-31 21:17:46 +00:00
Merge pull request #7398 from cakebaker/clippy_unnecessary_map_or
clippy: fix warnings from `unnecessary_map_or` lint
This commit is contained in:
commit
a82987b151
4 changed files with 8 additions and 21 deletions
|
@ -508,14 +508,12 @@ impl StatPrinter {
|
||||||
grand_total += size;
|
grand_total += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO fix requires an MSRV of 1.82
|
|
||||||
#[allow(clippy::unnecessary_map_or)]
|
|
||||||
if !self
|
if !self
|
||||||
.threshold
|
.threshold
|
||||||
.is_some_and(|threshold| threshold.should_exclude(size))
|
.is_some_and(|threshold| threshold.should_exclude(size))
|
||||||
&& self
|
&& self
|
||||||
.max_depth
|
.max_depth
|
||||||
.map_or(true, |max_depth| stat_info.depth <= max_depth)
|
.is_none_or(|max_depth| stat_info.depth <= max_depth)
|
||||||
&& (!self.summarize || stat_info.depth == 0)
|
&& (!self.summarize || stat_info.depth == 0)
|
||||||
{
|
{
|
||||||
self.print_stat(&stat_info.stat, size)?;
|
self.print_stat(&stat_info.stat, size)?;
|
||||||
|
|
|
@ -869,8 +869,6 @@ fn read_stream_and_create_pages(
|
||||||
let last_page = options.end_page;
|
let last_page = options.end_page;
|
||||||
let lines_needed_per_page = lines_to_read_for_page(options);
|
let lines_needed_per_page = lines_to_read_for_page(options);
|
||||||
|
|
||||||
// TODO fix requires an MSRV of 1.82
|
|
||||||
#[allow(clippy::unnecessary_map_or)]
|
|
||||||
Box::new(
|
Box::new(
|
||||||
lines
|
lines
|
||||||
.flat_map(split_lines_if_form_feed)
|
.flat_map(split_lines_if_form_feed)
|
||||||
|
@ -919,7 +917,7 @@ fn read_stream_and_create_pages(
|
||||||
let current_page = x + 1;
|
let current_page = x + 1;
|
||||||
|
|
||||||
current_page >= start_page
|
current_page >= start_page
|
||||||
&& last_page.map_or(true, |last_page| current_page <= last_page)
|
&& last_page.is_none_or(|last_page| current_page <= last_page)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -605,8 +605,7 @@ impl<'a> Line<'a> {
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO fix requires an MSRV of 1.82
|
|
||||||
#[allow(clippy::unnecessary_map_or)]
|
|
||||||
if settings.mode != SortMode::Random
|
if settings.mode != SortMode::Random
|
||||||
&& !settings.stable
|
&& !settings.stable
|
||||||
&& !settings.unique
|
&& !settings.unique
|
||||||
|
@ -618,7 +617,7 @@ impl<'a> Line<'a> {
|
||||||
|| settings
|
|| settings
|
||||||
.selectors
|
.selectors
|
||||||
.last()
|
.last()
|
||||||
.map_or(true, |selector| selector != &FieldSelector::default()))
|
.is_none_or(|selector| selector != &FieldSelector::default()))
|
||||||
{
|
{
|
||||||
// A last resort comparator is in use, underline the whole line.
|
// A last resort comparator is in use, underline the whole line.
|
||||||
if self.line.is_empty() {
|
if self.line.is_empty() {
|
||||||
|
|
|
@ -497,11 +497,9 @@ pub fn uu_app() -> Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TermiosFlag for ControlFlags {
|
impl TermiosFlag for ControlFlags {
|
||||||
// TODO fix requires an MSRV of 1.82
|
|
||||||
#[allow(clippy::unnecessary_map_or)]
|
|
||||||
fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool {
|
fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool {
|
||||||
termios.control_flags.contains(*self)
|
termios.control_flags.contains(*self)
|
||||||
&& group.map_or(true, |g| !termios.control_flags.intersects(g - *self))
|
&& group.is_none_or(|g| !termios.control_flags.intersects(g - *self))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn apply(&self, termios: &mut Termios, val: bool) {
|
fn apply(&self, termios: &mut Termios, val: bool) {
|
||||||
|
@ -510,11 +508,9 @@ impl TermiosFlag for ControlFlags {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TermiosFlag for InputFlags {
|
impl TermiosFlag for InputFlags {
|
||||||
// TODO fix requires an MSRV of 1.82
|
|
||||||
#[allow(clippy::unnecessary_map_or)]
|
|
||||||
fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool {
|
fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool {
|
||||||
termios.input_flags.contains(*self)
|
termios.input_flags.contains(*self)
|
||||||
&& group.map_or(true, |g| !termios.input_flags.intersects(g - *self))
|
&& group.is_none_or(|g| !termios.input_flags.intersects(g - *self))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn apply(&self, termios: &mut Termios, val: bool) {
|
fn apply(&self, termios: &mut Termios, val: bool) {
|
||||||
|
@ -523,11 +519,9 @@ impl TermiosFlag for InputFlags {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TermiosFlag for OutputFlags {
|
impl TermiosFlag for OutputFlags {
|
||||||
// TODO fix requires an MSRV of 1.82
|
|
||||||
#[allow(clippy::unnecessary_map_or)]
|
|
||||||
fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool {
|
fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool {
|
||||||
termios.output_flags.contains(*self)
|
termios.output_flags.contains(*self)
|
||||||
&& group.map_or(true, |g| !termios.output_flags.intersects(g - *self))
|
&& group.is_none_or(|g| !termios.output_flags.intersects(g - *self))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn apply(&self, termios: &mut Termios, val: bool) {
|
fn apply(&self, termios: &mut Termios, val: bool) {
|
||||||
|
@ -536,11 +530,9 @@ impl TermiosFlag for OutputFlags {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TermiosFlag for LocalFlags {
|
impl TermiosFlag for LocalFlags {
|
||||||
// TODO fix requires an MSRV of 1.82
|
|
||||||
#[allow(clippy::unnecessary_map_or)]
|
|
||||||
fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool {
|
fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool {
|
||||||
termios.local_flags.contains(*self)
|
termios.local_flags.contains(*self)
|
||||||
&& group.map_or(true, |g| !termios.local_flags.intersects(g - *self))
|
&& group.is_none_or(|g| !termios.local_flags.intersects(g - *self))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn apply(&self, termios: &mut Termios, val: bool) {
|
fn apply(&self, termios: &mut Termios, val: bool) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue