diff options
| author | Martin Haug <mhaug@live.de> | 2021-11-03 11:03:00 +0100 |
|---|---|---|
| committer | Martin Haug <mhaug@live.de> | 2021-11-03 11:03:00 +0100 |
| commit | 7016ab0d123ba06d0bbc6ed5001fa02fbd261bfa (patch) | |
| tree | 12e71a43e51a863509b71724ef882e3903d51357 /src/syntax/span.rs | |
| parent | 1e4cab393e55df8875c6303ebb7bde8f09f911c9 (diff) | |
Make stuff more elegant
Diffstat (limited to 'src/syntax/span.rs')
| -rw-r--r-- | src/syntax/span.rs | 6 |
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 } |
