Skip to content

Commit 4ee9d02

Browse files
committed
Requested changes
1 parent 802a6d3 commit 4ee9d02

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

clippy_lints/src/misc_early.rs

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
use crate::utils::{constants, snippet, snippet_opt, span_help_and_lint, span_lint, span_lint_and_then};
1+
use crate::utils::{
2+
constants, snippet, snippet_opt, span_help_and_lint, span_lint, span_lint_and_sugg, span_lint_and_then,
3+
};
24
use if_chain::if_chain;
35
use rustc::lint::{in_external_macro, EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
46
use rustc::{declare_lint_pass, declare_tool_lint};
@@ -399,19 +401,14 @@ impl MiscEarlyLints {
399401
for (idx, ch) in src.chars().enumerate() {
400402
if ch == 'i' || ch == 'u' {
401403
if prev != '_' {
402-
span_lint_and_then(
404+
span_lint_and_sugg(
403405
cx,
404406
UNSEPARATED_LITERAL_SUFFIX,
405407
lit.span,
406408
"integer type suffix should be separated by an underscore",
407-
|db| {
408-
db.span_suggestion(
409-
lit.span,
410-
"add an underscore",
411-
format!("{}_{}", &src[0..idx], &src[idx..]),
412-
Applicability::MachineApplicable,
413-
);
414-
},
409+
"add an underscore",
410+
format!("{}_{}", &src[0..idx], &src[idx..]),
411+
Applicability::MachineApplicable,
415412
);
416413
}
417414
break;
@@ -466,19 +463,14 @@ impl MiscEarlyLints {
466463
for (idx, ch) in src.chars().enumerate() {
467464
if ch == 'f' {
468465
if prev != '_' {
469-
span_lint_and_then(
466+
span_lint_and_sugg(
470467
cx,
471468
UNSEPARATED_LITERAL_SUFFIX,
472469
lit.span,
473470
"float type suffix should be separated by an underscore",
474-
|db| {
475-
db.span_suggestion(
476-
lit.span,
477-
"add an underscore",
478-
format!("{}_{}", &src[0..idx], &src[idx..]),
479-
Applicability::MachineApplicable,
480-
);
481-
},
471+
"add an underscore",
472+
format!("{}_{}", &src[0..idx], &src[idx..]),
473+
Applicability::MachineApplicable,
482474
);
483475
}
484476
break;

0 commit comments

Comments
 (0)