diff options
| author | Christiaan Dirkx <christiaan@dirkx.email> | 2020-09-20 10:46:30 +0200 |
|---|---|---|
| committer | Christiaan Dirkx <christiaan@dirkx.email> | 2020-09-20 10:46:30 +0200 |
| commit | a59d48064931ab860fb065e4ef3a2f5cc4276f96 (patch) | |
| tree | 2f5ee1d30fd8ec6aafeea81bd899bc227591d06e | |
| parent | ab4fa215b91491be0a7d2c3630efce7a6edb971d (diff) | |
| download | rust-a59d48064931ab860fb065e4ef3a2f5cc4276f96.tar.gz rust-a59d48064931ab860fb065e4ef3a2f5cc4276f96.zip | |
Remove `can_suggest` check for `is_ok` and `is_err`.
`is_ok` and `is_err` are stabilized as const and can thus always be suggested.
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/matches.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/tools/clippy/clippy_lints/src/matches.rs b/src/tools/clippy/clippy_lints/src/matches.rs index be879dfe28d..d20662f1ef9 100644 --- a/src/tools/clippy/clippy_lints/src/matches.rs +++ b/src/tools/clippy/clippy_lints/src/matches.rs @@ -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") { @@ -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 |
