diff options
| author | xiongmao86 <xiongmao86dev@sina.com> | 2020-04-17 22:01:25 +0800 |
|---|---|---|
| committer | xiongmao86 <xiongmao86dev@sina.com> | 2020-04-18 18:20:46 +0800 |
| commit | d03d3bd95b06b82246a51aaa8e424a67eb724037 (patch) | |
| tree | 18ede8cacee50a2931bec306f68f975d4e924c6c /clippy_lints/src/empty_enum.rs | |
| parent | bdd32e77007bb1ac0fe22d5f60bd9c7efe5b98c3 (diff) | |
| download | rust-d03d3bd95b06b82246a51aaa8e424a67eb724037.tar.gz rust-d03d3bd95b06b82246a51aaa8e424a67eb724037.zip | |
Fixes internal lint warning in code base.
Diffstat (limited to 'clippy_lints/src/empty_enum.rs')
| -rw-r--r-- | clippy_lints/src/empty_enum.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/clippy_lints/src/empty_enum.rs b/clippy_lints/src/empty_enum.rs index 77ae6dbde72..82c0bf93a7f 100644 --- a/clippy_lints/src/empty_enum.rs +++ b/clippy_lints/src/empty_enum.rs @@ -1,6 +1,6 @@ //! lint when there is an enum with no variants -use crate::utils::span_lint_and_then; +use crate::utils::span_lint_and_help; use rustc_hir::{Item, ItemKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; @@ -45,13 +45,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EmptyEnum { let ty = cx.tcx.type_of(did); let adt = ty.ty_adt_def().expect("already checked whether this is an enum"); if adt.variants.is_empty() { - span_lint_and_then(cx, EMPTY_ENUM, item.span, "enum with no variants", |diag| { - diag.span_help( - item.span, - "consider using the uninhabited type `!` (never type) or a wrapper \ - around it to introduce a type which can't be instantiated", - ); - }); + span_lint_and_then( + cx, + EMPTY_ENUM, + item.span, + "enum with no variants", + "consider using the uninhabited type `!` (never type) or a wrapper around it \ + to introduce a type which can't be instantiated", + ); } } } |
