Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: apply
clippy::unnecessary_map_or
lint suggestions
warning: this `map_or` is redundant --> src/cmd/luau.rs:367:15 | 367 | } else if std::path::Path::new(&args.arg_main_script) | _______________^ 368 | | .extension() 369 | | .map_or(false, |ext| ext.eq_ignore_ascii_case("luau")) | |______________________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or = note: `#[warn(clippy::unnecessary_map_or)]` on by default help: use is_some_and instead | 367 ~ } else if std::path::Path::new(&args.arg_main_script) 368 + .extension().is_some_and(|ext| ext.eq_ignore_ascii_case("luau")) | warning: this `map_or` is redundant --> src/cmd/luau.rs:370:12 | 370 | || std::path::Path::new(&args.arg_main_script) | ____________^ 371 | | .extension() 372 | | .map_or(false, |ext| ext.eq_ignore_ascii_case("lua")) | |_________________________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or help: use is_some_and instead | 370 ~ || std::path::Path::new(&args.arg_main_script) 371 + .extension().is_some_and(|ext| ext.eq_ignore_ascii_case("lua")) | warning: this `map_or` is redundant --> src/cmd/luau.rs:429:19 | 429 | } else if std::path::Path::new(begin) | ___________________^ 430 | | .extension() 431 | | .map_or(false, |ext| ext.eq_ignore_ascii_case("luau")) | |__________________________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or help: use is_some_and instead | 429 ~ } else if std::path::Path::new(begin) 430 + .extension().is_some_and(|ext| ext.eq_ignore_ascii_case("luau")) | warning: this `map_or` is redundant --> src/cmd/luau.rs:432:16 | 432 | || std::path::Path::new(begin) | ________________^ 433 | | .extension() 434 | | .map_or(false, |ext| ext.eq_ignore_ascii_case("lua")) | |_____________________________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or help: use is_some_and instead | 432 ~ || std::path::Path::new(begin) 433 + .extension().is_some_and(|ext| ext.eq_ignore_ascii_case("lua")) | warning: this `map_or` is redundant --> src/cmd/luau.rs:465:19 | 465 | } else if std::path::Path::new(end) | ___________________^ 466 | | .extension() 467 | | .map_or(false, |ext| ext.eq_ignore_ascii_case("luau")) | |__________________________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or help: use is_some_and instead | 465 ~ } else if std::path::Path::new(end) 466 + .extension().is_some_and(|ext| ext.eq_ignore_ascii_case("luau")) | warning: this `map_or` is redundant --> src/cmd/luau.rs:468:16 | 468 | || std::path::Path::new(end) | ________________^ 469 | | .extension() 470 | | .map_or(false, |ext| ext.eq_ignore_ascii_case("lua")) | |_____________________________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or help: use is_some_and instead | 468 ~ || std::path::Path::new(end) 469 + .extension().is_some_and(|ext| ext.eq_ignore_ascii_case("lua")) | warning: this `map_or` is redundant --> src/cmd/search.rs:168:21 | 168 | let flag_flag = args.flag_flag.map_or(false, |column_name| { | _____________________^ 169 | | // if --flag column is "M", then we only output the M column 170 | | if column_name == "M" { 171 | | headers.clear(); ... | 175 | | true 176 | | }); | |______^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or help: use is_some_and instead | 168 ~ let flag_flag = args.flag_flag.is_some_and(|column_name| { 169 + // if --flag column is "M", then we only output the M column 170 + if column_name == "M" { 171 + headers.clear(); 172 + matches_only = true; 173 + } 174 + headers.push_field(column_name.as_bytes()); 175 + true 176 ~ }); | warning: this `map_or` is redundant --> src/cmd/searchset.rs:199:25 | 199 | let do_match_list = args.flag_flag.map_or(false, |column_name| { | _________________________^ 200 | | headers.push_field(column_name.as_bytes()); 201 | | true 202 | | }); | |______^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or help: use is_some_and instead | 199 ~ let do_match_list = args.flag_flag.is_some_and(|column_name| { 200 + headers.push_field(column_name.as_bytes()); 201 + true 202 ~ }); | warning: this `map_or` is redundant --> src/cmd/sqlp.rs:634:25 | 634 | let is_sql_script = std::path::Path::new(&args.arg_sql) | _________________________^ 635 | | .extension() 636 | | .map_or(false, |ext| ext.eq_ignore_ascii_case("sql")); | |_____________________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or help: use is_some_and instead | 634 ~ let is_sql_script = std::path::Path::new(&args.arg_sql) 635 ~ .extension().is_some_and(|ext| ext.eq_ignore_ascii_case("sql")); | warning: this `map_or` is redundant --> src/cmd/sqlp.rs:700:12 | 700 | && std::path::Path::new(&args.arg_input[0]) | ____________^ 701 | | .extension() 702 | | .map_or(false, |ext| ext.eq_ignore_ascii_case("csv")) | |_________________________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or help: use is_some_and instead | 700 ~ && std::path::Path::new(&args.arg_input[0]) 701 + .extension().is_some_and(|ext| ext.eq_ignore_ascii_case("csv")) | warning: this `map_or` is redundant --> src/cmd/sqlp.rs:994:12 | 994 | if std::path::Path::new(&output) | ____________^ 995 | | .extension() 996 | | .map_or(false, |ext| ext.eq_ignore_ascii_case("sz")) | |________________________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or help: use is_some_and instead | 994 ~ if std::path::Path::new(&output) 995 + .extension().is_some_and(|ext| ext.eq_ignore_ascii_case("sz")) | warning: this `map_or` is redundant --> src/cmd/validate.rs:307:5 | 307 | / Currency::from_str(s).map_or(false, |c| { 308 | | if c.symbol().is_empty() { 309 | | true // allow empty currency symbol 310 | | } else { 311 | | qsv_currency::Currency::is_iso_currency(&c) 312 | | } 313 | | }) | |______^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or help: use is_ok_and instead | 307 ~ Currency::from_str(s).is_ok_and(|c| { 308 + if c.symbol().is_empty() { 309 + true // allow empty currency symbol 310 + } else { 311 + qsv_currency::Currency::is_iso_currency(&c) 312 + } 313 + })
- Loading branch information