@@ -238,45 +238,6 @@ pub fn source_range_no_file(tcx: TyCtxt<'_>, span: Span) -> String {
238238 format ! ( "{}:{}-{}:{}" , start. line, start. col. to_usize( ) + 1 , end. line, end. col. to_usize( ) + 1 )
239239}
240240
241- pub fn statement_kind_name ( statement : & Statement < ' _ > ) -> & ' static str {
242- use StatementKind :: * ;
243- match statement. kind {
244- Assign ( ..) => "Assign" ,
245- FakeRead ( ..) => "FakeRead" ,
246- SetDiscriminant { .. } => "SetDiscriminant" ,
247- Deinit ( ..) => "Deinit" ,
248- StorageLive ( ..) => "StorageLive" ,
249- StorageDead ( ..) => "StorageDead" ,
250- Retag ( ..) => "Retag" ,
251- PlaceMention ( ..) => "PlaceMention" ,
252- AscribeUserType ( ..) => "AscribeUserType" ,
253- Coverage ( ..) => "Coverage" ,
254- Intrinsic ( ..) => "Intrinsic" ,
255- ConstEvalCounter => "ConstEvalCounter" ,
256- Nop => "Nop" ,
257- }
258- }
259-
260- pub fn terminator_kind_name ( term : & Terminator < ' _ > ) -> & ' static str {
261- use TerminatorKind :: * ;
262- match term. kind {
263- Goto { .. } => "Goto" ,
264- SwitchInt { .. } => "SwitchInt" ,
265- UnwindResume => "Resume" ,
266- UnwindTerminate => "Terminate" ,
267- Return => "Return" ,
268- Unreachable => "Unreachable" ,
269- Drop { .. } => "Drop" ,
270- Call { .. } => "Call" ,
271- Assert { .. } => "Assert" ,
272- Yield { .. } => "Yield" ,
273- GeneratorDrop => "GeneratorDrop" ,
274- FalseEdge { .. } => "FalseEdge" ,
275- FalseUnwind { .. } => "FalseUnwind" ,
276- InlineAsm { .. } => "InlineAsm" ,
277- }
278- }
279-
280241fn statement_span_viewable < ' tcx > (
281242 tcx : TyCtxt < ' tcx > ,
282243 body_span : Span ,
@@ -304,7 +265,7 @@ fn terminator_span_viewable<'tcx>(
304265 if !body_span. contains ( span) {
305266 return None ;
306267 }
307- let id = format ! ( "{}:{}" , bb. index( ) , terminator_kind_name ( term) ) ;
268+ let id = format ! ( "{}:{}" , bb. index( ) , term. kind . name ( ) ) ;
308269 let tooltip = tooltip ( tcx, & id, span, vec ! [ ] , & data. terminator ) ;
309270 Some ( SpanViewable { bb, span, id, tooltip } )
310271}
@@ -631,7 +592,7 @@ fn tooltip<'tcx>(
631592 "\n {}{}: {}: {:?}" ,
632593 TOOLTIP_INDENT ,
633594 source_range,
634- statement_kind_name ( & statement) ,
595+ statement. kind . name ( ) ,
635596 statement
636597 ) ) ;
637598 }
@@ -641,7 +602,7 @@ fn tooltip<'tcx>(
641602 "\n {}{}: {}: {:?}" ,
642603 TOOLTIP_INDENT ,
643604 source_range,
644- terminator_kind_name ( term) ,
605+ term. kind . name ( ) ,
645606 term. kind
646607 ) ) ;
647608 }
0 commit comments