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