Auto merge of #115594 - nnethercote:span-tweaks, r=cjgillot

Span tweaks

Some minor improvements to code clarity.

r? `@cjgillot`
This commit is contained in:
bors
2023-09-09 10:56:24 +00:00
2 changed files with 146 additions and 121 deletions

View File

@@ -510,10 +510,6 @@ impl SpanData {
pub fn is_dummy(self) -> bool {
self.lo.0 == 0 && self.hi.0 == 0
}
#[inline]
pub fn is_visible(self, sm: &SourceMap) -> bool {
!self.is_dummy() && sm.is_span_accessible(self.span())
}
/// Returns `true` if `self` fully encloses `other`.
pub fn contains(self, other: Self) -> bool {
self.lo <= other.lo && other.hi <= self.hi
@@ -573,15 +569,9 @@ impl Span {
self.data().with_parent(ctxt)
}
/// Returns `true` if this is a dummy span with any hygienic context.
#[inline]
pub fn is_dummy(self) -> bool {
self.data_untracked().is_dummy()
}
#[inline]
pub fn is_visible(self, sm: &SourceMap) -> bool {
self.data_untracked().is_visible(sm)
!self.is_dummy() && sm.is_span_accessible(self)
}
/// Returns `true` if this span comes from any kind of macro, desugaring or inlining.