diff options
| author | Max Baumann <max@bmn.dev> | 2022-03-18 22:44:56 +0100 |
|---|---|---|
| committer | Max Baumann <max@bmn.dev> | 2022-03-18 22:44:56 +0100 |
| commit | f00e844a1f3b7e6d8a5d84e90baa37b0cebeac67 (patch) | |
| tree | f144c3f35473794a800d8a85ef86be95e337c7d2 /clippy_lints | |
| parent | 34ad33c57aa9db1b0c8473925affef08fadc7b8a (diff) | |
| download | rust-f00e844a1f3b7e6d8a5d84e90baa37b0cebeac67.tar.gz rust-f00e844a1f3b7e6d8a5d84e90baa37b0cebeac67.zip | |
feat: use span_lint_and_sugg
Diffstat (limited to 'clippy_lints')
| -rw-r--r-- | clippy_lints/src/methods/or_then_unwrap.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clippy_lints/src/methods/or_then_unwrap.rs b/clippy_lints/src/methods/or_then_unwrap.rs index 02fa5887f67..578f898da78 100644 --- a/clippy_lints/src/methods/or_then_unwrap.rs +++ b/clippy_lints/src/methods/or_then_unwrap.rs @@ -1,6 +1,7 @@ -use clippy_utils::diagnostics::span_lint_and_help; +use clippy_utils::diagnostics::span_lint_and_sugg; use clippy_utils::ty::is_type_diagnostic_item; use if_chain::if_chain; +use rustc_errors::Applicability; use rustc_hir::{Expr, ExprKind, QPath}; use rustc_lint::LateContext; use rustc_span::{sym, Span}; @@ -40,13 +41,14 @@ pub(super) fn check<'tcx>( unwrap_expr.span }; - span_lint_and_help( + span_lint_and_sugg( cx, OR_THEN_UNWRAP, or_span.to(unwrap_span), title, - None, - "use `unwrap_or()` instead", + "try this", + "unwrap_or(...)".into(), + Applicability::HasPlaceholders, ); } |
