about summary refs log tree commit diff
diff options
context:
space:
mode:
authorflip1995 <hello@philkrones.com>2020-04-03 21:31:47 +0200
committerflip1995 <hello@philkrones.com>2020-04-03 22:02:27 +0200
commit30503a91d2cd19239d0aed802cd740ec6f2a7e06 (patch)
tree4c2b79c1ebc397acea68168ce28bd392e8a8eb10
parent045722a17ea05cb11ae933578ee01a3d5d831352 (diff)
downloadrust-30503a91d2cd19239d0aed802cd740ec6f2a7e06.tar.gz
rust-30503a91d2cd19239d0aed802cd740ec6f2a7e06.zip
Move matches test in matches module
-rw-r--r--clippy_lints/src/matches.rs37
-rw-r--r--tests/matches.rs42
2 files changed, 37 insertions, 42 deletions
diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs
index 20b793f95de..4298e62b803 100644
--- a/clippy_lints/src/matches.rs
+++ b/clippy_lints/src/matches.rs
@@ -1197,3 +1197,40 @@ where
 
     None
 }
+
+#[test]
+fn test_overlapping() {
+    use rustc_span::source_map::DUMMY_SP;
+
+    let sp = |s, e| SpannedRange {
+        span: DUMMY_SP,
+        node: (s, e),
+    };
+
+    assert_eq!(None, overlapping::<u8>(&[]));
+    assert_eq!(None, overlapping(&[sp(1, Bound::Included(4))]));
+    assert_eq!(
+        None,
+        overlapping(&[sp(1, Bound::Included(4)), sp(5, Bound::Included(6))])
+    );
+    assert_eq!(
+        None,
+        overlapping(&[
+            sp(1, Bound::Included(4)),
+            sp(5, Bound::Included(6)),
+            sp(10, Bound::Included(11))
+        ],)
+    );
+    assert_eq!(
+        Some((&sp(1, Bound::Included(4)), &sp(3, Bound::Included(6)))),
+        overlapping(&[sp(1, Bound::Included(4)), sp(3, Bound::Included(6))])
+    );
+    assert_eq!(
+        Some((&sp(5, Bound::Included(6)), &sp(6, Bound::Included(11)))),
+        overlapping(&[
+            sp(1, Bound::Included(4)),
+            sp(5, Bound::Included(6)),
+            sp(6, Bound::Included(11))
+        ],)
+    );
+}
diff --git a/tests/matches.rs b/tests/matches.rs
deleted file mode 100644
index 6691c074caf..00000000000
--- a/tests/matches.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-#![feature(rustc_private)]
-
-extern crate rustc_span;
-use std::collections::Bound;
-
-#[test]
-fn test_overlapping() {
-    use clippy_lints::matches::overlapping;
-    use rustc_span::source_map::DUMMY_SP;
-
-    let sp = |s, e| clippy_lints::matches::SpannedRange {
-        span: DUMMY_SP,
-        node: (s, e),
-    };
-
-    assert_eq!(None, overlapping::<u8>(&[]));
-    assert_eq!(None, overlapping(&[sp(1, Bound::Included(4))]));
-    assert_eq!(
-        None,
-        overlapping(&[sp(1, Bound::Included(4)), sp(5, Bound::Included(6))])
-    );
-    assert_eq!(
-        None,
-        overlapping(&[
-            sp(1, Bound::Included(4)),
-            sp(5, Bound::Included(6)),
-            sp(10, Bound::Included(11))
-        ],)
-    );
-    assert_eq!(
-        Some((&sp(1, Bound::Included(4)), &sp(3, Bound::Included(6)))),
-        overlapping(&[sp(1, Bound::Included(4)), sp(3, Bound::Included(6))])
-    );
-    assert_eq!(
-        Some((&sp(5, Bound::Included(6)), &sp(6, Bound::Included(11)))),
-        overlapping(&[
-            sp(1, Bound::Included(4)),
-            sp(5, Bound::Included(6)),
-            sp(6, Bound::Included(11))
-        ],)
-    );
-}