summaryrefslogtreecommitdiff
path: root/src/syntax/span.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/syntax/span.rs')
-rw-r--r--src/syntax/span.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/syntax/span.rs b/src/syntax/span.rs
index a707d3d9..430d5f1d 100644
--- a/src/syntax/span.rs
+++ b/src/syntax/span.rs
@@ -127,12 +127,12 @@ impl Span {
/// Create a new span with n characters inserted inside of this span.
pub fn inserted(mut self, other: Self, n: usize) -> Self {
- if !self.contains(other.start) || !self.contains(other.end) {
+ if !self.surrounds(other) {
panic!();
}
- let len_change = (n as isize - other.len() as isize) as usize;
- self.end += len_change;
+ let len_change = n as isize - other.len() as isize;
+ self.end += len_change as usize;
self
}