Skip to content

Commit

Permalink
Remove can_suggest check for is_ok and is_err.
Browse files Browse the repository at this point in the history
`is_ok` and `is_err` are stabilized as const and can thus always be suggested.
  • Loading branch information
CDirkx committed Sep 20, 2020
1 parent ab4fa21 commit a59d480
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/tools/clippy/clippy_lints/src/matches.rs
Expand Up @@ -1469,10 +1469,10 @@ mod redundant_pattern_match {
keyword: &'static str,
) {
fn find_suggestion(cx: &LateContext<'_>, hir_id: HirId, path: &QPath<'_>) -> Option<&'static str> {
if match_qpath(path, &paths::RESULT_OK) && can_suggest(cx, hir_id, sym!(result_type), "is_ok") {
if match_qpath(path, &paths::RESULT_OK) {
return Some("is_ok()");
}
if match_qpath(path, &paths::RESULT_ERR) && can_suggest(cx, hir_id, sym!(result_type), "is_err") {
if match_qpath(path, &paths::RESULT_ERR) {
return Some("is_err()");
}
if match_qpath(path, &paths::OPTION_SOME) && can_suggest(cx, hir_id, sym!(option_type), "is_some") {
Expand Down Expand Up @@ -1562,8 +1562,8 @@ mod redundant_pattern_match {
&paths::RESULT_ERR,
"is_ok()",
"is_err()",
|| can_suggest(cx, hir_id, sym!(result_type), "is_ok"),
|| can_suggest(cx, hir_id, sym!(result_type), "is_err"),
|| true,
|| true
)
} else {
None
Expand Down

0 comments on commit a59d480

Please sign in to comment.