Skip to content

Commit

Permalink
Rollup merge of #108523 - TaKO8Ki:avoid-str-to-string-conversions, r=…
Browse files Browse the repository at this point in the history
…Nilstrieb

Avoid `&str` to `String` conversions

This patch removes some unnecessary `&str` to `String` conversions.
  • Loading branch information
matthiaskrgr committed Feb 27, 2023
2 parents 585d33e + 934c8c2 commit 828b66e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
).span_suggestion_verbose(
lhs.span.shrink_to_lo(),
"you might have meant to introduce a new binding",
"let ".to_string(),
"let ",
Applicability::MachineApplicable,
).emit();
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/move_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
err.span_suggestion_verbose(
span.shrink_to_lo(),
"consider borrowing here",
"&".to_string(),
'&',
Applicability::MaybeIncorrect,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
err.span_suggestion_verbose(
local_decl.source_info.span.shrink_to_lo(),
"consider changing this to be mutable",
"mut ".to_string(),
"mut ",
Applicability::MachineApplicable,
);
let tcx = self.infcx.tcx;
Expand Down

0 comments on commit 828b66e

Please sign in to comment.