Skip to content

Commit

Permalink
Change lint name to expect_err
Browse files Browse the repository at this point in the history
  • Loading branch information
b-ncMN committed Mar 31, 2022
1 parent 5166a3b commit a11fc56
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions clippy_lints/src/methods/expect_err.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::EXPECT_ERR;
use super::ERR_EXPECT;
use clippy_utils::{diagnostics::span_lint_and_help, meets_msrv, msrvs, ty::is_type_diagnostic_item};
use rustc_lint::LateContext;
use rustc_semver::RustcVersion;
Expand All @@ -8,7 +8,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &rustc_hir::Expr<'_>, recv: &rus
if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(recv), sym::Result) & meets_msrv(msrv, &msrvs::EXPECT_ERR) {
span_lint_and_help(
cx,
EXPECT_ERR,
ERR_EXPECT,
expr.span,
"called `.err().expect()` on a `Result` value",
None,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ declare_clippy_lint! {
/// ### Why is this bad?
/// Because .expect_err() can be called directly.
#[clippy::version = "1.61.0"]
pub EXPECT_ERR,
pub ERR_EXPECT,
style,
r#"using `.err().expect("")` when `.expect_err("")` can be used"#
}
Expand Down Expand Up @@ -2178,7 +2178,7 @@ impl_lint_pass!(Methods => [
NEEDLESS_SPLITN,
UNNECESSARY_TO_OWNED,
UNNECESSARY_JOIN,
EXPECT_ERR,
ERR_EXPECT,
]);

/// Extracts a method call name, args, and `Span` of the method name.
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/expect_err.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: called `.err().expect()` on a `Result` value
LL | x.err().expect("Testing expect_err");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::expect-err` implied by `-D warnings`
= note: `-D clippy::err-expect` implied by `-D warnings`
= help: `.expect_err()` can be called instead

error: aborting due to previous error
Expand Down

0 comments on commit a11fc56

Please sign in to comment.