diff options
| author | Jamie McClymont <jamie@kwiius.com> | 2019-08-19 14:18:05 +1200 |
|---|---|---|
| committer | Jamie McClymont <jamie@kwiius.com> | 2019-08-19 14:20:38 +1200 |
| commit | 4ee9d02efa1be614482fe6082851302eb2f330f6 (patch) | |
| tree | 597c2e6f6fa9b1e5879c493597564f3c3ff5e198 | |
| parent | 802a6d33dae32a116881990566bb1d5d7e62a9ab (diff) | |
| download | rust-4ee9d02efa1be614482fe6082851302eb2f330f6.tar.gz rust-4ee9d02efa1be614482fe6082851302eb2f330f6.zip | |
Requested changes
| -rw-r--r-- | clippy_lints/src/misc_early.rs | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/clippy_lints/src/misc_early.rs b/clippy_lints/src/misc_early.rs index aabd5ace331..c8ac26044eb 100644 --- a/clippy_lints/src/misc_early.rs +++ b/clippy_lints/src/misc_early.rs @@ -1,4 +1,6 @@ -use crate::utils::{constants, snippet, snippet_opt, span_help_and_lint, span_lint, span_lint_and_then}; +use crate::utils::{ + constants, snippet, snippet_opt, span_help_and_lint, span_lint, span_lint_and_sugg, span_lint_and_then, +}; use if_chain::if_chain; use rustc::lint::{in_external_macro, EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass}; use rustc::{declare_lint_pass, declare_tool_lint}; @@ -399,19 +401,14 @@ impl MiscEarlyLints { for (idx, ch) in src.chars().enumerate() { if ch == 'i' || ch == 'u' { if prev != '_' { - span_lint_and_then( + span_lint_and_sugg( cx, UNSEPARATED_LITERAL_SUFFIX, lit.span, "integer type suffix should be separated by an underscore", - |db| { - db.span_suggestion( - lit.span, - "add an underscore", - format!("{}_{}", &src[0..idx], &src[idx..]), - Applicability::MachineApplicable, - ); - }, + "add an underscore", + format!("{}_{}", &src[0..idx], &src[idx..]), + Applicability::MachineApplicable, ); } break; @@ -466,19 +463,14 @@ impl MiscEarlyLints { for (idx, ch) in src.chars().enumerate() { if ch == 'f' { if prev != '_' { - span_lint_and_then( + span_lint_and_sugg( cx, UNSEPARATED_LITERAL_SUFFIX, lit.span, "float type suffix should be separated by an underscore", - |db| { - db.span_suggestion( - lit.span, - "add an underscore", - format!("{}_{}", &src[0..idx], &src[idx..]), - Applicability::MachineApplicable, - ); - }, + "add an underscore", + format!("{}_{}", &src[0..idx], &src[idx..]), + Applicability::MachineApplicable, ); } break; |
