Check with overlaps_or_adjacent
This commit is contained in:
@@ -627,6 +627,13 @@ impl Span {
|
||||
span.lo < other.hi && other.lo < span.hi
|
||||
}
|
||||
|
||||
/// Returns `true` if `self` touches or adjoins `other`.
|
||||
pub fn overlaps_or_adjacent(self, other: Span) -> bool {
|
||||
let span = self.data();
|
||||
let other = other.data();
|
||||
span.lo <= other.hi && other.lo <= span.hi
|
||||
}
|
||||
|
||||
/// Returns `true` if the spans are equal with regards to the source text.
|
||||
///
|
||||
/// Use this instead of `==` when either span could be generated code,
|
||||
|
||||
Reference in New Issue
Block a user