@@ -140,7 +140,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList {
140
140
if src. rlib . is_some ( ) {
141
141
continue ;
142
142
}
143
- sess. emit_err ( RlibRequired { crate_name : tcx. crate_name ( cnum) . to_string ( ) } ) ;
143
+ sess. emit_err ( RlibRequired { crate_name : tcx. crate_name ( cnum) } ) ;
144
144
}
145
145
return Vec :: new ( ) ;
146
146
}
@@ -224,10 +224,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList {
224
224
Linkage :: Static => "rlib" ,
225
225
_ => "dylib" ,
226
226
} ;
227
- sess. emit_err ( LibRequired {
228
- crate_name : tcx. crate_name ( cnum) . to_string ( ) ,
229
- kind : kind. to_string ( ) ,
230
- } ) ;
227
+ sess. emit_err ( LibRequired { crate_name : tcx. crate_name ( cnum) , kind : kind } ) ;
231
228
}
232
229
}
233
230
}
@@ -251,8 +248,7 @@ fn add_library(
251
248
// This error is probably a little obscure, but I imagine that it
252
249
// can be refined over time.
253
250
if link2 != link || link == RequireStatic {
254
- tcx. sess
255
- . emit_err ( CrateDepMultiple { crate_name : tcx. crate_name ( cnum) . to_string ( ) } ) ;
251
+ tcx. sess . emit_err ( CrateDepMultiple { crate_name : tcx. crate_name ( cnum) } ) ;
256
252
}
257
253
}
258
254
None => {
@@ -347,8 +343,8 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
347
343
348
344
if tcx. is_panic_runtime ( cnum) {
349
345
if let Some ( ( prev, _) ) = panic_runtime {
350
- let prev_name = tcx. crate_name ( prev) . to_string ( ) ;
351
- let cur_name = tcx. crate_name ( cnum) . to_string ( ) ;
346
+ let prev_name = tcx. crate_name ( prev) ;
347
+ let cur_name = tcx. crate_name ( cnum) ;
352
348
sess. emit_err ( TwoPanicRuntimes { prev_name, cur_name } ) ;
353
349
}
354
350
panic_runtime = Some ( (
@@ -370,8 +366,8 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
370
366
// our same strategy.
371
367
if found_strategy != desired_strategy {
372
368
sess. emit_err ( BadPanicStrategy {
373
- runtime : tcx. crate_name ( runtime_cnum) . to_string ( ) ,
374
- strategy : desired_strategy. desc ( ) . to_string ( ) ,
369
+ runtime : tcx. crate_name ( runtime_cnum) ,
370
+ strategy : desired_strategy,
375
371
} ) ;
376
372
}
377
373
@@ -390,17 +386,17 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
390
386
391
387
if let Some ( found_strategy) = tcx. required_panic_strategy ( cnum) && desired_strategy != found_strategy {
392
388
sess. emit_err ( RequiredPanicStrategy {
393
- crate_name : tcx. crate_name ( cnum) . to_string ( ) ,
394
- found_strategy : found_strategy . desc ( ) . to_string ( ) ,
395
- desired_strategy : desired_strategy . desc ( ) . to_string ( ) } ) ;
389
+ crate_name : tcx. crate_name ( cnum) ,
390
+ found_strategy,
391
+ desired_strategy} ) ;
396
392
}
397
393
398
394
let found_drop_strategy = tcx. panic_in_drop_strategy ( cnum) ;
399
395
if tcx. sess . opts . unstable_opts . panic_in_drop != found_drop_strategy {
400
396
sess. emit_err ( IncompatiblePanicInDropStrategy {
401
- crate_name : tcx. crate_name ( cnum) . to_string ( ) ,
402
- found_strategy : found_drop_strategy. desc ( ) . to_string ( ) ,
403
- desired_strategy : tcx. sess . opts . unstable_opts . panic_in_drop . desc ( ) . to_string ( ) ,
397
+ crate_name : tcx. crate_name ( cnum) ,
398
+ found_strategy : found_drop_strategy,
399
+ desired_strategy : tcx. sess . opts . unstable_opts . panic_in_drop ,
404
400
} ) ;
405
401
}
406
402
}
0 commit comments