Skip to content

Commit 18c6818

Browse files
committed
Auto merge of #9341 - bmc-msft:suggest-map_or-instead-of-unwrap_or, r=giraffate
suggest map_or in case_sensitive_file_extension_comparisons changelog: [`case_sensitive_file_extension_comparisons `]: updated suggestion in the example to use `map_or` Currently, case_sensitive_file_extension_comparisons suggests using `map(..).unwrap_or(..)` which trips up the `map_unwrap_or` lint. This updates the suggestion to use `map_or`.
2 parents a331766 + bfeaae8 commit 18c6818

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

clippy_lints/src/case_sensitive_file_extension_comparisons.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ declare_clippy_lint! {
2626
/// fn is_rust_file(filename: &str) -> bool {
2727
/// let filename = std::path::Path::new(filename);
2828
/// filename.extension()
29-
/// .map(|ext| ext.eq_ignore_ascii_case("rs"))
30-
/// .unwrap_or(false)
29+
/// .map_or(false, |ext| ext.eq_ignore_ascii_case("rs"))
3130
/// }
3231
/// ```
3332
#[clippy::version = "1.51.0"]

0 commit comments

Comments
 (0)