@@ -645,34 +645,29 @@ impl<'a, 'tcx> SpanDecoder for CacheDecoder<'a, 'tcx> {
645645 let parent = Option :: < LocalDefId > :: decode ( self ) ;
646646 let tag: u8 = Decodable :: decode ( self ) ;
647647
648- if tag == TAG_PARTIAL_SPAN {
649- return Span :: new ( BytePos ( 0 ) , BytePos ( 0 ) , ctxt, parent) ;
650- } else if tag == TAG_RELATIVE_SPAN {
651- let dlo = u32:: decode ( self ) ;
652- let dto = u32:: decode ( self ) ;
653-
654- let enclosing = self . tcx . source_span_untracked ( parent. unwrap ( ) ) . data_untracked ( ) ;
655- let span = Span :: new (
656- enclosing. lo + BytePos :: from_u32 ( dlo) ,
657- enclosing. lo + BytePos :: from_u32 ( dto) ,
658- ctxt,
659- parent,
660- ) ;
661-
662- return span;
663- } else {
664- debug_assert_eq ! ( tag, TAG_FULL_SPAN ) ;
665- }
666-
667- let file_lo_index = SourceFileIndex :: decode ( self ) ;
668- let line_lo = usize:: decode ( self ) ;
669- let col_lo = RelativeBytePos :: decode ( self ) ;
670- let len = BytePos :: decode ( self ) ;
671-
672- let file_lo = self . file_index_to_file ( file_lo_index) ;
673- let lo = file_lo. lines ( ) [ line_lo - 1 ] + col_lo;
674- let lo = file_lo. absolute_position ( lo) ;
675- let hi = lo + len;
648+ let ( lo, hi) = match tag {
649+ TAG_PARTIAL_SPAN => ( BytePos ( 0 ) , BytePos ( 0 ) ) ,
650+ TAG_RELATIVE_SPAN => {
651+ let dlo = u32:: decode ( self ) ;
652+ let dto = u32:: decode ( self ) ;
653+
654+ let enclosing = self . tcx . source_span_untracked ( parent. unwrap ( ) ) . data_untracked ( ) ;
655+ ( enclosing. lo + BytePos :: from_u32 ( dlo) , enclosing. lo + BytePos :: from_u32 ( dto) )
656+ }
657+ TAG_FULL_SPAN => {
658+ let file_lo_index = SourceFileIndex :: decode ( self ) ;
659+ let line_lo = usize:: decode ( self ) ;
660+ let col_lo = RelativeBytePos :: decode ( self ) ;
661+ let len = BytePos :: decode ( self ) ;
662+
663+ let file_lo = self . file_index_to_file ( file_lo_index) ;
664+ let lo = file_lo. lines ( ) [ line_lo - 1 ] + col_lo;
665+ let lo = file_lo. absolute_position ( lo) ;
666+ let hi = lo + len;
667+ ( lo, hi)
668+ }
669+ _ => unreachable ! ( ) ,
670+ } ;
676671
677672 Span :: new ( lo, hi, ctxt, parent)
678673 }
0 commit comments