Skip to content

Commit 8a9ad72

Browse files
committed
Nit: use Range::contains
1 parent ba12ed0 commit 8a9ad72

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/libsyntax/errors/snippet/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use codemap::{CharPos, CodeMap, FileMap, LineInfo, Span};
1414
use std::cmp;
1515
use std::rc::Rc;
1616
use std::mem;
17-
use std::ops::Range;
1817

1918
mod test;
2019

@@ -744,10 +743,6 @@ fn overlaps(a1: &Annotation,
744743
a2: &Annotation)
745744
-> bool
746745
{
747-
between(a1.start_col, a2.start_col .. a2.end_col) ||
748-
between(a2.start_col, a1.start_col .. a1.end_col)
749-
}
750-
751-
fn between(v: usize, range: Range<usize>) -> bool {
752-
v >= range.start && v < range.end
746+
(a2.start_col .. a2.end_col).contains(a1.start_col) ||
747+
(a1.start_col .. a1.end_col).contains(a2.start_col)
753748
}

src/libsyntax/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#![feature(str_escape)]
3434
#![feature(unicode)]
3535
#![feature(question_mark)]
36+
#![feature(range_contains)]
3637

3738
extern crate serialize;
3839
extern crate term;

0 commit comments

Comments
 (0)