|
1 |
| -use crate::utils::{constants, snippet, snippet_opt, span_help_and_lint, span_lint, span_lint_and_then}; |
| 1 | +use crate::utils::{constants, snippet, snippet_opt, span_help_and_lint, span_lint, span_lint_and_then, span_lint_and_sugg}; |
2 | 2 | use if_chain::if_chain;
|
3 | 3 | use rustc::lint::{in_external_macro, EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
|
4 | 4 | use rustc::{declare_lint_pass, declare_tool_lint};
|
@@ -399,19 +399,14 @@ impl MiscEarlyLints {
|
399 | 399 | for (idx, ch) in src.chars().enumerate() {
|
400 | 400 | if ch == 'i' || ch == 'u' {
|
401 | 401 | if prev != '_' {
|
402 |
| - span_lint_and_then( |
| 402 | + span_lint_and_sugg( |
403 | 403 | cx,
|
404 | 404 | UNSEPARATED_LITERAL_SUFFIX,
|
405 | 405 | lit.span,
|
406 | 406 | "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 |
| - }, |
| 407 | + "add an underscore", |
| 408 | + format!("{}_{}", &src[0..idx], &src[idx..]), |
| 409 | + Applicability::MachineApplicable, |
415 | 410 | );
|
416 | 411 | }
|
417 | 412 | break;
|
@@ -466,19 +461,14 @@ impl MiscEarlyLints {
|
466 | 461 | for (idx, ch) in src.chars().enumerate() {
|
467 | 462 | if ch == 'f' {
|
468 | 463 | if prev != '_' {
|
469 |
| - span_lint_and_then( |
| 464 | + span_lint_and_sugg( |
470 | 465 | cx,
|
471 | 466 | UNSEPARATED_LITERAL_SUFFIX,
|
472 | 467 | lit.span,
|
473 | 468 | "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 |
| - }, |
| 469 | + "add an underscore", |
| 470 | + format!("{}_{}", &src[0..idx], &src[idx..]), |
| 471 | + Applicability::MachineApplicable, |
482 | 472 | );
|
483 | 473 | }
|
484 | 474 | break;
|
|
0 commit comments