@@ -316,11 +316,7 @@ impl Span {
316316
317317 /// Returns `self` if `self` is not the dummy span, and `other` otherwise.
318318 pub fn substitute_dummy ( self , other : Span ) -> Span {
319- if self . is_dummy ( ) {
320- other
321- } else {
322- self
323- }
319+ if self . is_dummy ( ) { other } else { self }
324320 }
325321
326322 /// Returns `true` if `self` fully encloses `other`.
@@ -351,33 +347,21 @@ impl Span {
351347 pub fn trim_start ( self , other : Span ) -> Option < Span > {
352348 let span = self . data ( ) ;
353349 let other = other. data ( ) ;
354- if span. hi > other. hi {
355- Some ( span. with_lo ( cmp:: max ( span. lo , other. hi ) ) )
356- } else {
357- None
358- }
350+ if span. hi > other. hi { Some ( span. with_lo ( cmp:: max ( span. lo , other. hi ) ) ) } else { None }
359351 }
360352
361353 /// Returns the source span -- this is either the supplied span, or the span for
362354 /// the macro callsite that expanded to it.
363355 pub fn source_callsite ( self ) -> Span {
364356 let expn_data = self . ctxt ( ) . outer_expn_data ( ) ;
365- if !expn_data. is_root ( ) {
366- expn_data. call_site . source_callsite ( )
367- } else {
368- self
369- }
357+ if !expn_data. is_root ( ) { expn_data. call_site . source_callsite ( ) } else { self }
370358 }
371359
372360 /// The `Span` for the tokens in the previous macro expansion from which `self` was generated,
373361 /// if any.
374362 pub fn parent ( self ) -> Option < Span > {
375363 let expn_data = self . ctxt ( ) . outer_expn_data ( ) ;
376- if !expn_data. is_root ( ) {
377- Some ( expn_data. call_site )
378- } else {
379- None
380- }
364+ if !expn_data. is_root ( ) { Some ( expn_data. call_site ) } else { None }
381365 }
382366
383367 /// Edition of the crate from which this span came.
@@ -403,18 +387,10 @@ impl Span {
403387 pub fn source_callee ( self ) -> Option < ExpnData > {
404388 fn source_callee ( expn_data : ExpnData ) -> ExpnData {
405389 let next_expn_data = expn_data. call_site . ctxt ( ) . outer_expn_data ( ) ;
406- if !next_expn_data. is_root ( ) {
407- source_callee ( next_expn_data)
408- } else {
409- expn_data
410- }
390+ if !next_expn_data. is_root ( ) { source_callee ( next_expn_data) } else { expn_data }
411391 }
412392 let expn_data = self . ctxt ( ) . outer_expn_data ( ) ;
413- if !expn_data. is_root ( ) {
414- Some ( source_callee ( expn_data) )
415- } else {
416- None
417- }
393+ if !expn_data. is_root ( ) { Some ( source_callee ( expn_data) ) } else { None }
418394 }
419395
420396 /// Checks if a span is "internal" to a macro in which `#[unstable]`
@@ -1234,11 +1210,7 @@ impl SourceFile {
12341210
12351211 let line_index = lookup_line ( & self . lines [ ..] , pos) ;
12361212 assert ! ( line_index < self . lines. len( ) as isize ) ;
1237- if line_index >= 0 {
1238- Some ( line_index as usize )
1239- } else {
1240- None
1241- }
1213+ if line_index >= 0 { Some ( line_index as usize ) } else { None }
12421214 }
12431215
12441216 pub fn line_bounds ( & self , line_index : usize ) -> ( BytePos , BytePos ) {
0 commit comments