Skip to content

Commit b40274c

Browse files
committed
simplify span_to_remove
1 parent e03ca09 commit b40274c

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

clippy_lints/src/let_with_type_underscore.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use clippy_utils::diagnostics::span_lint_and_then;
22
use clippy_utils::is_from_proc_macro;
3-
use clippy_utils::source::{IntoSpan, SpanRangeExt};
43
use rustc_ast::{Local, TyKind};
54
use rustc_errors::Applicability;
65
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
@@ -35,19 +34,14 @@ impl EarlyLintPass for UnderscoreTyped {
3534
&& !local.span.in_external_macro(sm)
3635
&& !is_from_proc_macro(cx, &**ty)
3736
{
38-
let span_to_remove = sm
39-
.span_extend_to_prev_char_before(ty.span, ':', true)
40-
.with_leading_whitespace(cx)
41-
.into_span();
42-
4337
span_lint_and_then(
4438
cx,
4539
LET_WITH_TYPE_UNDERSCORE,
4640
local.span,
4741
"variable declared with type underscore",
4842
|diag| {
4943
diag.span_suggestion_verbose(
50-
span_to_remove,
44+
ty.span.with_lo(local.pat.span.hi()),
5145
"remove the explicit type `_` declaration",
5246
"",
5347
Applicability::MachineApplicable,

0 commit comments

Comments
 (0)