@@ -140,7 +140,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList {
140140 if src. rlib . is_some ( ) {
141141 continue ;
142142 }
143- sess. emit_err ( RlibRequired { crate_name : tcx. crate_name ( cnum) . to_string ( ) } ) ;
143+ sess. emit_err ( RlibRequired { crate_name : tcx. crate_name ( cnum) } ) ;
144144 }
145145 return Vec :: new ( ) ;
146146 }
@@ -224,10 +224,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList {
224224 Linkage :: Static => "rlib" ,
225225 _ => "dylib" ,
226226 } ;
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 } ) ;
231228 }
232229 }
233230 }
@@ -251,8 +248,7 @@ fn add_library(
251248 // This error is probably a little obscure, but I imagine that it
252249 // can be refined over time.
253250 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) } ) ;
256252 }
257253 }
258254 None => {
@@ -347,8 +343,8 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
347343
348344 if tcx. is_panic_runtime ( cnum) {
349345 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) ;
352348 sess. emit_err ( TwoPanicRuntimes { prev_name, cur_name } ) ;
353349 }
354350 panic_runtime = Some ( (
@@ -370,8 +366,8 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
370366 // our same strategy.
371367 if found_strategy != desired_strategy {
372368 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,
375371 } ) ;
376372 }
377373
@@ -390,17 +386,17 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
390386
391387 if let Some ( found_strategy) = tcx. required_panic_strategy ( cnum) && desired_strategy != found_strategy {
392388 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} ) ;
396392 }
397393
398394 let found_drop_strategy = tcx. panic_in_drop_strategy ( cnum) ;
399395 if tcx. sess . opts . unstable_opts . panic_in_drop != found_drop_strategy {
400396 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 ,
404400 } ) ;
405401 }
406402 }
0 commit comments