@@ -611,7 +611,7 @@ impl Span {
611
611
612
612
#[ inline]
613
613
/// Returns `true` if `hi == lo`.
614
- pub fn is_empty ( & self ) -> bool {
614
+ pub fn is_empty ( self ) -> bool {
615
615
let span = self . data_untracked ( ) ;
616
616
span. hi == span. lo
617
617
}
@@ -639,7 +639,7 @@ impl Span {
639
639
///
640
640
/// Use this instead of `==` when either span could be generated code,
641
641
/// and you only care that they point to the same bytes of source text.
642
- pub fn source_equal ( & self , other : & Span ) -> bool {
642
+ pub fn source_equal ( self , other : Span ) -> bool {
643
643
let span = self . data ( ) ;
644
644
let other = other. data ( ) ;
645
645
span. lo == other. lo && span. hi == other. hi
@@ -680,17 +680,17 @@ impl Span {
680
680
}
681
681
682
682
#[ inline]
683
- pub fn rust_2015 ( & self ) -> bool {
683
+ pub fn rust_2015 ( self ) -> bool {
684
684
self . edition ( ) == edition:: Edition :: Edition2015
685
685
}
686
686
687
687
#[ inline]
688
- pub fn rust_2018 ( & self ) -> bool {
688
+ pub fn rust_2018 ( self ) -> bool {
689
689
self . edition ( ) >= edition:: Edition :: Edition2018
690
690
}
691
691
692
692
#[ inline]
693
- pub fn rust_2021 ( & self ) -> bool {
693
+ pub fn rust_2021 ( self ) -> bool {
694
694
self . edition ( ) >= edition:: Edition :: Edition2021
695
695
}
696
696
@@ -711,15 +711,15 @@ impl Span {
711
711
/// Checks if a span is "internal" to a macro in which `#[unstable]`
712
712
/// items can be used (that is, a macro marked with
713
713
/// `#[allow_internal_unstable]`).
714
- pub fn allows_unstable ( & self , feature : Symbol ) -> bool {
714
+ pub fn allows_unstable ( self , feature : Symbol ) -> bool {
715
715
self . ctxt ( )
716
716
. outer_expn_data ( )
717
717
. allow_internal_unstable
718
718
. map_or ( false , |features| features. iter ( ) . any ( |& f| f == feature) )
719
719
}
720
720
721
721
/// Checks if this span arises from a compiler desugaring of kind `kind`.
722
- pub fn is_desugaring ( & self , kind : DesugaringKind ) -> bool {
722
+ pub fn is_desugaring ( self , kind : DesugaringKind ) -> bool {
723
723
match self . ctxt ( ) . outer_expn_data ( ) . kind {
724
724
ExpnKind :: Desugaring ( k) => k == kind,
725
725
_ => false ,
@@ -728,7 +728,7 @@ impl Span {
728
728
729
729
/// Returns the compiler desugaring that created this span, or `None`
730
730
/// if this span is not from a desugaring.
731
- pub fn desugaring_kind ( & self ) -> Option < DesugaringKind > {
731
+ pub fn desugaring_kind ( self ) -> Option < DesugaringKind > {
732
732
match self . ctxt ( ) . outer_expn_data ( ) . kind {
733
733
ExpnKind :: Desugaring ( k) => Some ( k) ,
734
734
_ => None ,
@@ -738,7 +738,7 @@ impl Span {
738
738
/// Checks if a span is "internal" to a macro in which `unsafe`
739
739
/// can be used without triggering the `unsafe_code` lint.
740
740
// (that is, a macro marked with `#[allow_internal_unsafe]`).
741
- pub fn allows_unsafe ( & self ) -> bool {
741
+ pub fn allows_unsafe ( self ) -> bool {
742
742
self . ctxt ( ) . outer_expn_data ( ) . allow_internal_unsafe
743
743
}
744
744
@@ -751,7 +751,7 @@ impl Span {
751
751
return None ;
752
752
}
753
753
754
- let is_recursive = expn_data. call_site . source_equal ( & prev_span) ;
754
+ let is_recursive = expn_data. call_site . source_equal ( prev_span) ;
755
755
756
756
prev_span = self ;
757
757
self = expn_data. call_site ;
@@ -865,13 +865,13 @@ impl Span {
865
865
866
866
/// Equivalent of `Span::call_site` from the proc macro API,
867
867
/// except that the location is taken from the `self` span.
868
- pub fn with_call_site_ctxt ( & self , expn_id : ExpnId ) -> Span {
868
+ pub fn with_call_site_ctxt ( self , expn_id : ExpnId ) -> Span {
869
869
self . with_ctxt_from_mark ( expn_id, Transparency :: Transparent )
870
870
}
871
871
872
872
/// Equivalent of `Span::mixed_site` from the proc macro API,
873
873
/// except that the location is taken from the `self` span.
874
- pub fn with_mixed_site_ctxt ( & self , expn_id : ExpnId ) -> Span {
874
+ pub fn with_mixed_site_ctxt ( self , expn_id : ExpnId ) -> Span {
875
875
self . with_ctxt_from_mark ( expn_id, Transparency :: SemiTransparent )
876
876
}
877
877
0 commit comments