@@ -898,8 +898,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
898
898
899
899
// unsafe extern "C" for<'a> fn(&'a T) -> &'a T
900
900
// ^^^^^^
901
- values.0.push(sig1.unsafety.prefix_str().to_string() , sig1.unsafety != sig2.unsafety);
902
- values.1.push(sig2.unsafety.prefix_str().to_string() , sig1.unsafety != sig2.unsafety);
901
+ values.0.push(sig1.unsafety.prefix_str(), sig1.unsafety != sig2.unsafety);
902
+ values.1.push(sig2.unsafety.prefix_str(), sig1.unsafety != sig2.unsafety);
903
903
904
904
// unsafe extern "C" for<'a> fn(&'a T) -> &'a T
905
905
// ^^^^^^^^^^
@@ -918,8 +918,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
918
918
919
919
// unsafe extern "C" for<'a> fn(&'a T) -> &'a T
920
920
// ^^^
921
- values.0.push_normal("fn(".to_string() );
922
- values.1.push_normal("fn(".to_string() );
921
+ values.0.push_normal("fn(");
922
+ values.1.push_normal("fn(");
923
923
924
924
// unsafe extern "C" for<'a> fn(&'a T) -> &'a T
925
925
// ^^^^^
@@ -936,46 +936,46 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
936
936
for (i, l) in sig1.inputs().iter().enumerate() {
937
937
values.0.push_highlighted(l.to_string());
938
938
if i != len1 - 1 {
939
- values.0.push_highlighted(", ".to_string() );
939
+ values.0.push_highlighted(", ");
940
940
}
941
941
}
942
942
for (i, r) in sig2.inputs().iter().enumerate() {
943
943
values.1.push_highlighted(r.to_string());
944
944
if i != len2 - 1 {
945
- values.1.push_highlighted(", ".to_string() );
945
+ values.1.push_highlighted(", ");
946
946
}
947
947
}
948
948
}
949
949
950
950
if sig1.c_variadic {
951
951
if len1 > 0 {
952
- values.0.push_normal(", ".to_string() );
952
+ values.0.push_normal(", ");
953
953
}
954
- values.0.push("...".to_string() , !sig2.c_variadic);
954
+ values.0.push("...", !sig2.c_variadic);
955
955
}
956
956
if sig2.c_variadic {
957
957
if len2 > 0 {
958
- values.1.push_normal(", ".to_string() );
958
+ values.1.push_normal(", ");
959
959
}
960
- values.1.push("...".to_string() , !sig1.c_variadic);
960
+ values.1.push("...", !sig1.c_variadic);
961
961
}
962
962
963
963
// unsafe extern "C" for<'a> fn(&'a T) -> &'a T
964
964
// ^
965
- values.0.push_normal(")".to_string() );
966
- values.1.push_normal(")".to_string() );
965
+ values.0.push_normal(")");
966
+ values.1.push_normal(")");
967
967
968
968
// unsafe extern "C" for<'a> fn(&'a T) -> &'a T
969
969
// ^^^^^^^^
970
970
let output1 = sig1.output();
971
971
let output2 = sig2.output();
972
972
let (x1, x2) = self.cmp(output1, output2);
973
973
if !output1.is_unit() {
974
- values.0.push_normal(" -> ".to_string() );
974
+ values.0.push_normal(" -> ");
975
975
(values.0).0.extend(x1.0);
976
976
}
977
977
if !output2.is_unit() {
978
- values.1.push_normal(" -> ".to_string() );
978
+ values.1.push_normal(" -> ");
979
979
(values.1).0.extend(x2.0);
980
980
}
981
981
values
@@ -1240,8 +1240,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
1240
1240
// When encountering tuples of the same size, highlight only the differing types
1241
1241
(&ty::Tuple(substs1), &ty::Tuple(substs2)) if substs1.len() == substs2.len() => {
1242
1242
let mut values = (
1243
- DiagnosticStyledString::normal("(".to_string() ),
1244
- DiagnosticStyledString::normal("(".to_string() ),
1243
+ DiagnosticStyledString::normal("("),
1244
+ DiagnosticStyledString::normal("("),
1245
1245
);
1246
1246
let len = substs1.len();
1247
1247
for (i, (left, right)) in substs1.types().zip(substs2.types()).enumerate() {
@@ -1251,11 +1251,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
1251
1251
self.push_comma(&mut values.0, &mut values.1, len, i);
1252
1252
}
1253
1253
if len == 1 { // Keep the output for single element tuples as `(ty,)`.
1254
- values.0.push_normal(",".to_string() );
1255
- values.1.push_normal(",".to_string() );
1254
+ values.0.push_normal(",");
1255
+ values.1.push_normal(",");
1256
1256
}
1257
- values.0.push_normal(")".to_string() );
1258
- values.1.push_normal(")".to_string() );
1257
+ values.0.push_normal(")");
1258
+ values.1.push_normal(")");
1259
1259
values
1260
1260
}
1261
1261
0 commit comments