Skip to content

Commit

Permalink
remove unnecessary to_string and String::new for `tool_only_span_…
Browse files Browse the repository at this point in the history
…suggestion`
  • Loading branch information
TaKO8Ki committed Jun 13, 2022
1 parent 77d6176 commit fd1290a
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ fn err_duplicate_option<'a>(p: &mut Parser<'a>, symbol: Symbol, span: Span) {
err.tool_only_span_suggestion(
full_span,
"remove this option",
String::new(),
"",
Applicability::MachineApplicable,
);

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ impl<'a, 'b> Context<'a, 'b> {
err.tool_only_span_suggestion(
sp,
&format!("use the `{}` trait", name),
(*fmt).to_string(),
*fmt,
Applicability::MaybeIncorrect,
);
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/parser/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2596,7 +2596,7 @@ impl<'a> Parser<'a> {
err.tool_only_span_suggestion(
label.ident.span.until(self.token.span),
"remove this block label",
String::new(),
"",
Applicability::MachineApplicable,
);
err.emit();
Expand Down
9 changes: 2 additions & 7 deletions compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ impl<'a> Resolver<'a> {
err.tool_only_span_suggestion(
import.use_span_with_attributes,
"remove unnecessary import",
String::new(),
"",
Applicability::MaybeIncorrect,
);
}
Expand Down Expand Up @@ -396,12 +396,7 @@ impl<'a> Resolver<'a> {
// previous imports.
if found_closing_brace {
if let Some(span) = extend_span_to_previous_binding(self.session, span) {
err.tool_only_span_suggestion(
span,
message,
String::new(),
Applicability::MaybeIncorrect,
);
err.tool_only_span_suggestion(span, message, "", Applicability::MaybeIncorrect);
} else {
// Remove the entire line if we cannot extend the span back, this indicates an
// `issue_52891::{self}` case.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_typeck/src/check/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
err.tool_only_span_suggestion(
semi_span,
"remove this semicolon",
String::new(),
"",
Applicability::MaybeIncorrect,
);
}),
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/needless_late_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ fn check<'tcx>(
diag.tool_only_span_suggestion(
local_stmt.span,
"remove the local",
String::new(),
"",
Applicability::MachineApplicable,
);

Expand Down

0 comments on commit fd1290a

Please sign in to comment.