Nit: use Range::contains
This commit is contained in:
parent
ba12ed06ed
commit
8a9ad72c1d
@ -14,7 +14,6 @@ use codemap::{CharPos, CodeMap, FileMap, LineInfo, Span};
|
|||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ops::Range;
|
|
||||||
|
|
||||||
mod test;
|
mod test;
|
||||||
|
|
||||||
@ -744,10 +743,6 @@ fn overlaps(a1: &Annotation,
|
|||||||
a2: &Annotation)
|
a2: &Annotation)
|
||||||
-> bool
|
-> bool
|
||||||
{
|
{
|
||||||
between(a1.start_col, a2.start_col .. a2.end_col) ||
|
(a2.start_col .. a2.end_col).contains(a1.start_col) ||
|
||||||
between(a2.start_col, a1.start_col .. a1.end_col)
|
(a1.start_col .. a1.end_col).contains(a2.start_col)
|
||||||
}
|
|
||||||
|
|
||||||
fn between(v: usize, range: Range<usize>) -> bool {
|
|
||||||
v >= range.start && v < range.end
|
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#![feature(str_escape)]
|
#![feature(str_escape)]
|
||||||
#![feature(unicode)]
|
#![feature(unicode)]
|
||||||
#![feature(question_mark)]
|
#![feature(question_mark)]
|
||||||
|
#![feature(range_contains)]
|
||||||
|
|
||||||
extern crate serialize;
|
extern crate serialize;
|
||||||
extern crate term;
|
extern crate term;
|
||||||
|
Loading…
Reference in New Issue
Block a user