From 8a9ad72c1d67261049aac1d067529da48adcc644 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 26 Apr 2016 22:59:15 -0400 Subject: [PATCH] Nit: use Range::contains --- src/libsyntax/errors/snippet/mod.rs | 9 ++------- src/libsyntax/lib.rs | 1 + 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/libsyntax/errors/snippet/mod.rs b/src/libsyntax/errors/snippet/mod.rs index 643b5c3c5f2..feaf48352db 100644 --- a/src/libsyntax/errors/snippet/mod.rs +++ b/src/libsyntax/errors/snippet/mod.rs @@ -14,7 +14,6 @@ use codemap::{CharPos, CodeMap, FileMap, LineInfo, Span}; use std::cmp; use std::rc::Rc; use std::mem; -use std::ops::Range; mod test; @@ -744,10 +743,6 @@ fn overlaps(a1: &Annotation, a2: &Annotation) -> bool { - between(a1.start_col, a2.start_col .. a2.end_col) || - between(a2.start_col, a1.start_col .. a1.end_col) -} - -fn between(v: usize, range: Range) -> bool { - v >= range.start && v < range.end + (a2.start_col .. a2.end_col).contains(a1.start_col) || + (a1.start_col .. a1.end_col).contains(a2.start_col) } diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 6cfa1e9847b..420a41e03b9 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -33,6 +33,7 @@ #![feature(str_escape)] #![feature(unicode)] #![feature(question_mark)] +#![feature(range_contains)] extern crate serialize; extern crate term;