Skip to content

Commit fa27c7a

Browse files
authored
Unrolled build for rust-lang#120592
Rollup merge of rust-lang#120592 - trevyn:cleanup-to-string, r=Nilstrieb Remove unnecessary `.to_string()`/`.as_str()`s
2 parents 671eb38 + ef37dcb commit fa27c7a

File tree

10 files changed

+15
-15
lines changed

10 files changed

+15
-15
lines changed

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2440,7 +2440,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
24402440
"consider consuming the `{ty}` when turning it into an \
24412441
`Iterator`",
24422442
),
2443-
"into_iter".to_string(),
2443+
"into_iter",
24442444
Applicability::MaybeIncorrect,
24452445
);
24462446
}

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
924924
err.span_suggestion_verbose(
925925
expr.span.shrink_to_lo(),
926926
"use a mutable iterator instead",
927-
"mut ".to_string(),
927+
"mut ",
928928
Applicability::MachineApplicable,
929929
);
930930
}

compiler/rustc_hir_analysis/src/astconv/errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
247247
err.span_suggestion_verbose(
248248
assoc_name.span,
249249
fluent::hir_analysis_assoc_item_not_found_similar_in_other_trait_with_bound_sugg,
250-
suggested_name.to_string(),
250+
suggested_name,
251251
Applicability::MaybeIncorrect,
252252
);
253253
}

compiler/rustc_hir_typeck/src/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10001000
err.span_suggestion_verbose(
10011001
lhs.span.shrink_to_hi(),
10021002
"you might have meant to write a semicolon here",
1003-
";".to_string(),
1003+
";",
10041004
Applicability::MachineApplicable,
10051005
);
10061006
return true;

compiler/rustc_hir_typeck/src/method/suggest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1116,9 +1116,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11161116
item_name.span,
11171117
format!(
11181118
"you might have meant to use `{}`",
1119-
inherent_method.name.as_str()
1119+
inherent_method.name
11201120
),
1121-
inherent_method.name.as_str(),
1121+
inherent_method.name,
11221122
Applicability::MaybeIncorrect,
11231123
);
11241124
break 'outer;
@@ -2019,7 +2019,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
20192019
diag.span_suggestion_verbose(
20202020
sm.span_extend_while(seg1.ident.span.shrink_to_hi(), |c| c == ':').unwrap(),
20212021
"you may have meant to call an instance method",
2022-
".".to_string(),
2022+
".",
20232023
Applicability::MaybeIncorrect,
20242024
);
20252025
}

compiler/rustc_parse/src/parser/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3288,7 +3288,7 @@ impl<'a> Parser<'a> {
32883288
} else {
32893289
Applicability::MaybeIncorrect
32903290
};
3291-
err.span_suggestion_verbose(sugg_sp, msg, "=> ".to_string(), applicability);
3291+
err.span_suggestion_verbose(sugg_sp, msg, "=> ", applicability);
32923292
}
32933293
}
32943294
err

compiler/rustc_parse/src/parser/generics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl<'a> Parser<'a> {
148148
.with_span_suggestion_verbose(
149149
mistyped_const_ident.span,
150150
"use the `const` keyword",
151-
kw::Const.as_str(),
151+
kw::Const,
152152
Applicability::MachineApplicable,
153153
)
154154
.emit();

compiler/rustc_parse/src/parser/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,7 @@ impl<'a> Parser<'a> {
14531453
err.span_suggestion_verbose(
14541454
prev_span,
14551455
"perhaps you meant to use `struct` here",
1456-
"struct".to_string(),
1456+
"struct",
14571457
Applicability::MaybeIncorrect,
14581458
);
14591459
}

compiler/rustc_resolve/src/late/diagnostics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
699699
err.span_suggestion_verbose(
700700
span.shrink_to_lo(),
701701
msg,
702-
"self.".to_string(),
702+
"self.",
703703
Applicability::MachineApplicable,
704704
);
705705
}
@@ -710,7 +710,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
710710
err.span_suggestion_verbose(
711711
span.shrink_to_lo(),
712712
format!("you might have meant to {}", candidate.action()),
713-
"Self::".to_string(),
713+
"Self::",
714714
Applicability::MachineApplicable,
715715
);
716716
}

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
12881288
err.span_suggestion_verbose(
12891289
obligation.cause.span.shrink_to_hi(),
12901290
"consider using clone here",
1291-
".clone()".to_string(),
1291+
".clone()",
12921292
Applicability::MaybeIncorrect,
12931293
);
12941294
return true;
@@ -3245,7 +3245,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
32453245
err.span_suggestion_verbose(
32463246
span,
32473247
"you can use `impl Trait` as the argument type",
3248-
"impl ".to_string(),
3248+
"impl ",
32493249
Applicability::MaybeIncorrect,
32503250
);
32513251
let sugg = if !needs_parens {
@@ -5203,7 +5203,7 @@ fn point_at_assoc_type_restriction(
52035203
err.span_suggestion_verbose(
52045204
path.span,
52055205
"replace the associated type with the type specified in this `impl`",
5206-
tcx.type_of(new.def_id).skip_binder().to_string(),
5206+
tcx.type_of(new.def_id).skip_binder(),
52075207
Applicability::MachineApplicable,
52085208
);
52095209
}

0 commit comments

Comments
 (0)