diff --git a/src/cmd/luau.rs b/src/cmd/luau.rs index eceaedead..584553a63 100644 --- a/src/cmd/luau.rs +++ b/src/cmd/luau.rs @@ -366,10 +366,10 @@ pub fn run(argv: &[&str]) -> CliResult<()> { } } else if std::path::Path::new(&args.arg_main_script) .extension() - .map_or(false, |ext| ext.eq_ignore_ascii_case("luau")) + .is_some_and(|ext| ext.eq_ignore_ascii_case("luau")) || std::path::Path::new(&args.arg_main_script) .extension() - .map_or(false, |ext| ext.eq_ignore_ascii_case("lua")) + .is_some_and(|ext| ext.eq_ignore_ascii_case("lua")) { match fs::read_to_string(args.arg_main_script.clone()) { Ok(file_contents) => file_contents, @@ -428,10 +428,10 @@ pub fn run(argv: &[&str]) -> CliResult<()> { } } else if std::path::Path::new(begin) .extension() - .map_or(false, |ext| ext.eq_ignore_ascii_case("luau")) + .is_some_and(|ext| ext.eq_ignore_ascii_case("luau")) || std::path::Path::new(begin) .extension() - .map_or(false, |ext| ext.eq_ignore_ascii_case("lua")) + .is_some_and(|ext| ext.eq_ignore_ascii_case("lua")) { match fs::read_to_string(begin.clone()) { Ok(file_contents) => file_contents, @@ -464,10 +464,10 @@ pub fn run(argv: &[&str]) -> CliResult<()> { } } else if std::path::Path::new(end) .extension() - .map_or(false, |ext| ext.eq_ignore_ascii_case("luau")) + .is_some_and(|ext| ext.eq_ignore_ascii_case("luau")) || std::path::Path::new(end) .extension() - .map_or(false, |ext| ext.eq_ignore_ascii_case("lua")) + .is_some_and(|ext| ext.eq_ignore_ascii_case("lua")) { match fs::read_to_string(end.clone()) { Ok(file_contents) => file_contents, diff --git a/src/cmd/search.rs b/src/cmd/search.rs index ba3307a6a..a65d898de 100644 --- a/src/cmd/search.rs +++ b/src/cmd/search.rs @@ -165,7 +165,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> { let mut matches_only = false; - let flag_flag = args.flag_flag.map_or(false, |column_name| { + let flag_flag = args.flag_flag.is_some_and(|column_name| { // if --flag column is "M", then we only output the M column if column_name == "M" { headers.clear(); diff --git a/src/cmd/searchset.rs b/src/cmd/searchset.rs index f42080b73..068096ae0 100644 --- a/src/cmd/searchset.rs +++ b/src/cmd/searchset.rs @@ -196,7 +196,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> { let mut headers = rdr.byte_headers()?.clone(); let sel = rconfig.selection(&headers)?; - let do_match_list = args.flag_flag.map_or(false, |column_name| { + let do_match_list = args.flag_flag.is_some_and(|column_name| { headers.push_field(column_name.as_bytes()); true }); diff --git a/src/cmd/sqlp.rs b/src/cmd/sqlp.rs index 2da13d806..3e4a5abbf 100644 --- a/src/cmd/sqlp.rs +++ b/src/cmd/sqlp.rs @@ -633,7 +633,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> { // check if the input is a SQL script (ends with .sql) let is_sql_script = std::path::Path::new(&args.arg_sql) .extension() - .map_or(false, |ext| ext.eq_ignore_ascii_case("sql")); + .is_some_and(|ext| ext.eq_ignore_ascii_case("sql")); // if infer_len is 0, its not a SQL script, and there is only one input CSV, we can infer the // schema of the CSV more intelligently by counting the number of rows in the file instead of @@ -699,7 +699,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> { && comment_char.is_none() && std::path::Path::new(&args.arg_input[0]) .extension() - .map_or(false, |ext| ext.eq_ignore_ascii_case("csv")) + .is_some_and(|ext| ext.eq_ignore_ascii_case("csv")) { // replace all instances of the FROM clause case-insensitive in the SQL query with the // read_csv function using a regex @@ -993,7 +993,7 @@ pub fn compress_output_if_needed( if let Some(output) = output_file { if std::path::Path::new(&output) .extension() - .map_or(false, |ext| ext.eq_ignore_ascii_case("sz")) + .is_some_and(|ext| ext.eq_ignore_ascii_case("sz")) { log::info!("Compressing output with Snappy"); diff --git a/src/cmd/validate.rs b/src/cmd/validate.rs index d4ae82001..c9510a516 100644 --- a/src/cmd/validate.rs +++ b/src/cmd/validate.rs @@ -304,7 +304,7 @@ impl From> for CliError { #[inline] /// Checks if a given string represents a valid currency format. fn currency_format_checker(s: &str) -> bool { - Currency::from_str(s).map_or(false, |c| { + Currency::from_str(s).is_ok_and(|c| { if c.symbol().is_empty() { true // allow empty currency symbol } else {