Skip to content

Commit fd1290a

Browse files
committed
remove unnecessary to_string and String::new for tool_only_span_suggestion
1 parent 77d6176 commit fd1290a

File tree

6 files changed

+7
-12
lines changed

6 files changed

+7
-12
lines changed

compiler/rustc_builtin_macros/src/asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ fn err_duplicate_option<'a>(p: &mut Parser<'a>, symbol: Symbol, span: Span) {
363363
err.tool_only_span_suggestion(
364364
full_span,
365365
"remove this option",
366-
String::new(),
366+
"",
367367
Applicability::MachineApplicable,
368368
);
369369

compiler/rustc_builtin_macros/src/format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ impl<'a, 'b> Context<'a, 'b> {
330330
err.tool_only_span_suggestion(
331331
sp,
332332
&format!("use the `{}` trait", name),
333-
(*fmt).to_string(),
333+
*fmt,
334334
Applicability::MaybeIncorrect,
335335
);
336336
}

compiler/rustc_parse/src/parser/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2596,7 +2596,7 @@ impl<'a> Parser<'a> {
25962596
err.tool_only_span_suggestion(
25972597
label.ident.span.until(self.token.span),
25982598
"remove this block label",
2599-
String::new(),
2599+
"",
26002600
Applicability::MachineApplicable,
26012601
);
26022602
err.emit();

compiler/rustc_resolve/src/diagnostics.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ impl<'a> Resolver<'a> {
271271
err.tool_only_span_suggestion(
272272
import.use_span_with_attributes,
273273
"remove unnecessary import",
274-
String::new(),
274+
"",
275275
Applicability::MaybeIncorrect,
276276
);
277277
}
@@ -396,12 +396,7 @@ impl<'a> Resolver<'a> {
396396
// previous imports.
397397
if found_closing_brace {
398398
if let Some(span) = extend_span_to_previous_binding(self.session, span) {
399-
err.tool_only_span_suggestion(
400-
span,
401-
message,
402-
String::new(),
403-
Applicability::MaybeIncorrect,
404-
);
399+
err.tool_only_span_suggestion(span, message, "", Applicability::MaybeIncorrect);
405400
} else {
406401
// Remove the entire line if we cannot extend the span back, this indicates an
407402
// `issue_52891::{self}` case.

compiler/rustc_typeck/src/check/_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
174174
err.tool_only_span_suggestion(
175175
semi_span,
176176
"remove this semicolon",
177-
String::new(),
177+
"",
178178
Applicability::MaybeIncorrect,
179179
);
180180
}),

src/tools/clippy/clippy_lints/src/needless_late_init.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ fn check<'tcx>(
281281
diag.tool_only_span_suggestion(
282282
local_stmt.span,
283283
"remove the local",
284-
String::new(),
284+
"",
285285
Applicability::MachineApplicable,
286286
);
287287

0 commit comments

Comments
 (0)