1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
11 #![feature(rustc_private)]
13 extern crate clippy_lints;
15 use std::collections::Bound;
18 fn test_overlapping() {
19 use clippy_lints::matches::overlapping;
20 use crate::syntax::source_map::DUMMY_SP;
22 let sp = |s, e| clippy_lints::matches::SpannedRange {
27 assert_eq!(None, overlapping::<u8>(&[]));
28 assert_eq!(None, overlapping(&[sp(1, Bound::Included(4))]));
31 overlapping(&[sp(1, Bound::Included(4)), sp(5, Bound::Included(6))])
36 sp(1, Bound::Included(4)),
37 sp(5, Bound::Included(6)),
38 sp(10, Bound::Included(11))
42 Some((&sp(1, Bound::Included(4)), &sp(3, Bound::Included(6)))),
43 overlapping(&[sp(1, Bound::Included(4)), sp(3, Bound::Included(6))])
46 Some((&sp(5, Bound::Included(6)), &sp(6, Bound::Included(11)))),
48 sp(1, Bound::Included(4)),
49 sp(5, Bound::Included(6)),
50 sp(6, Bound::Included(11))