Nit: use Range::contains

This commit is contained in:
Niko Matsakis 2016-04-26 22:59:15 -04:00
parent ba12ed06ed
commit 8a9ad72c1d
2 changed files with 3 additions and 7 deletions

View File

@ -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
} }

View File

@ -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;