Skip to content

Commit

Permalink
Requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JJJollyjim committed Aug 19, 2019
1 parent 802a6d3 commit 35bfe1e
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions clippy_lints/src/misc_early.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
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_then, span_lint_and_sugg};
use if_chain::if_chain;
use rustc::lint::{in_external_macro, EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
use rustc::{declare_lint_pass, declare_tool_lint};
Expand Down Expand Up @@ -399,19 +399,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;
Expand Down Expand Up @@ -466,19 +461,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;
Expand Down

0 comments on commit 35bfe1e

Please sign in to comment.