Skip to content

Commit 49fc420

Browse files
Add is_empty method to Span
1 parent 24fbb30 commit 49fc420

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/libsyntax_pos/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,13 @@ impl Span {
280280
self.data().with_ctxt(ctxt)
281281
}
282282

283+
#[inline]
284+
/// Returns `true` if this `Span` contains no text.
285+
pub fn is_empty(self) -> bool {
286+
let span = self.data();
287+
span.lo == span.hi
288+
}
289+
283290
/// Returns `true` if this is a dummy span with any hygienic context.
284291
#[inline]
285292
pub fn is_dummy(self) -> bool {

0 commit comments

Comments
 (0)