|
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 | +}; |
2 | 4 | use if_chain::if_chain; |
3 | 5 | use rustc::lint::{in_external_macro, EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass}; |
4 | 6 | use rustc::{declare_lint_pass, declare_tool_lint}; |
@@ -399,19 +401,14 @@ impl MiscEarlyLints { |
399 | 401 | for (idx, ch) in src.chars().enumerate() { |
400 | 402 | if ch == 'i' || ch == 'u' { |
401 | 403 | if prev != '_' { |
402 | | - span_lint_and_then( |
| 404 | + span_lint_and_sugg( |
403 | 405 | cx, |
404 | 406 | UNSEPARATED_LITERAL_SUFFIX, |
405 | 407 | lit.span, |
406 | 408 | "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, |
415 | 412 | ); |
416 | 413 | } |
417 | 414 | break; |
@@ -466,19 +463,14 @@ impl MiscEarlyLints { |
466 | 463 | for (idx, ch) in src.chars().enumerate() { |
467 | 464 | if ch == 'f' { |
468 | 465 | if prev != '_' { |
469 | | - span_lint_and_then( |
| 466 | + span_lint_and_sugg( |
470 | 467 | cx, |
471 | 468 | UNSEPARATED_LITERAL_SUFFIX, |
472 | 469 | lit.span, |
473 | 470 | "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, |
482 | 474 | ); |
483 | 475 | } |
484 | 476 | break; |
|
0 commit comments