@@ -306,11 +306,7 @@ impl Span {
306306
307307 /// Returns `self` if `self` is not the dummy span, and `other` otherwise.
308308 pub fn substitute_dummy ( self , other : Span ) -> Span {
309- if self . is_dummy ( ) {
310- other
311- } else {
312- self
313- }
309+ if self . is_dummy ( ) { other } else { self }
314310 }
315311
316312 /// Returns `true` if `self` fully encloses `other`.
@@ -341,33 +337,21 @@ impl Span {
341337 pub fn trim_start ( self , other : Span ) -> Option < Span > {
342338 let span = self . data ( ) ;
343339 let other = other. data ( ) ;
344- if span. hi > other. hi {
345- Some ( span. with_lo ( cmp:: max ( span. lo , other. hi ) ) )
346- } else {
347- None
348- }
340+ if span. hi > other. hi { Some ( span. with_lo ( cmp:: max ( span. lo , other. hi ) ) ) } else { None }
349341 }
350342
351343 /// Returns the source span -- this is either the supplied span, or the span for
352344 /// the macro callsite that expanded to it.
353345 pub fn source_callsite ( self ) -> Span {
354346 let expn_data = self . ctxt ( ) . outer_expn_data ( ) ;
355- if !expn_data. is_root ( ) {
356- expn_data. call_site . source_callsite ( )
357- } else {
358- self
359- }
347+ if !expn_data. is_root ( ) { expn_data. call_site . source_callsite ( ) } else { self }
360348 }
361349
362350 /// The `Span` for the tokens in the previous macro expansion from which `self` was generated,
363351 /// if any.
364352 pub fn parent ( self ) -> Option < Span > {
365353 let expn_data = self . ctxt ( ) . outer_expn_data ( ) ;
366- if !expn_data. is_root ( ) {
367- Some ( expn_data. call_site )
368- } else {
369- None
370- }
354+ if !expn_data. is_root ( ) { Some ( expn_data. call_site ) } else { None }
371355 }
372356
373357 /// Edition of the crate from which this span came.
@@ -393,18 +377,10 @@ impl Span {
393377 pub fn source_callee ( self ) -> Option < ExpnData > {
394378 fn source_callee ( expn_data : ExpnData ) -> ExpnData {
395379 let next_expn_data = expn_data. call_site . ctxt ( ) . outer_expn_data ( ) ;
396- if !next_expn_data. is_root ( ) {
397- source_callee ( next_expn_data)
398- } else {
399- expn_data
400- }
380+ if !next_expn_data. is_root ( ) { source_callee ( next_expn_data) } else { expn_data }
401381 }
402382 let expn_data = self . ctxt ( ) . outer_expn_data ( ) ;
403- if !expn_data. is_root ( ) {
404- Some ( source_callee ( expn_data) )
405- } else {
406- None
407- }
383+ if !expn_data. is_root ( ) { Some ( source_callee ( expn_data) ) } else { None }
408384 }
409385
410386 /// Checks if a span is "internal" to a macro in which `#[unstable]`
@@ -1224,11 +1200,7 @@ impl SourceFile {
12241200
12251201 let line_index = lookup_line ( & self . lines [ ..] , pos) ;
12261202 assert ! ( line_index < self . lines. len( ) as isize ) ;
1227- if line_index >= 0 {
1228- Some ( line_index as usize )
1229- } else {
1230- None
1231- }
1203+ if line_index >= 0 { Some ( line_index as usize ) } else { None }
12321204 }
12331205
12341206 pub fn line_bounds ( & self , line_index : usize ) -> ( BytePos , BytePos ) {
0 commit comments