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.
10 #![feature(rustc_private)]
13 use std::collections::Bound;
16 fn test_overlapping() {
17 use clippy_lints::matches::overlapping;
18 use syntax::source_map::DUMMY_SP;
20 let sp = |s, e| clippy_lints::matches::SpannedRange {
25 assert_eq!(None, overlapping::<u8>(&[]));
26 assert_eq!(None, overlapping(&[sp(1, Bound::Included(4))]));
29 overlapping(&[sp(1, Bound::Included(4)), sp(5, Bound::Included(6))])
34 sp(1, Bound::Included(4)),
35 sp(5, Bound::Included(6)),
36 sp(10, Bound::Included(11))
40 Some((&sp(1, Bound::Included(4)), &sp(3, Bound::Included(6)))),
41 overlapping(&[sp(1, Bound::Included(4)), sp(3, Bound::Included(6))])
44 Some((&sp(5, Bound::Included(6)), &sp(6, Bound::Included(11)))),
46 sp(1, Bound::Included(4)),
47 sp(5, Bound::Included(6)),
48 sp(6, Bound::Included(11))