diff --git a/clippy_lints/src/methods/expect_err.rs b/clippy_lints/src/methods/expect_err.rs index f9f23b364d44..60dcc18acde2 100644 --- a/clippy_lints/src/methods/expect_err.rs +++ b/clippy_lints/src/methods/expect_err.rs @@ -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; @@ -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, diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index a214b680827a..6192866e0db2 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -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"# } @@ -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. diff --git a/tests/ui/expect_err.stderr b/tests/ui/expect_err.stderr index 4e0a58f14d8c..b5e38d3d7784 100644 --- a/tests/ui/expect_err.stderr +++ b/tests/ui/expect_err.stderr @@ -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