aboutsummaryrefslogtreecommitdiff
path: root/tools/src
diff options
context:
space:
mode:
Diffstat (limited to 'tools/src')
-rw-r--r--tools/src/lib.rs10
-rw-r--r--tools/src/main.rs7
2 files changed, 9 insertions, 8 deletions
diff --git a/tools/src/lib.rs b/tools/src/lib.rs
index 157818bdf..1b7ef3ca9 100644
--- a/tools/src/lib.rs
+++ b/tools/src/lib.rs
@@ -1,4 +1,6 @@
1extern crate itertools; 1extern crate itertools;
2
3use std::hash;
2use itertools::Itertools; 4use itertools::Itertools;
3 5
4#[derive(Debug, Eq)] 6#[derive(Debug, Eq)]
@@ -14,6 +16,12 @@ impl PartialEq for Test {
14 } 16 }
15} 17}
16 18
19impl hash::Hash for Test {
20 fn hash<H: hash::Hasher>(&self, state: &mut H) {
21 self.name.hash(state)
22 }
23}
24
17pub fn collect_tests(s: &str) -> Vec<Test> { 25pub fn collect_tests(s: &str) -> Vec<Test> {
18 let mut res = vec![]; 26 let mut res = vec![];
19 let prefix = "// "; 27 let prefix = "// ";
@@ -21,7 +29,7 @@ pub fn collect_tests(s: &str) -> Vec<Test> {
21 .lines() 29 .lines()
22 .map(str::trim_left) 30 .map(str::trim_left)
23 .enumerate() 31 .enumerate()
24 .group_by(|(idx, line)| line.starts_with(prefix)); 32 .group_by(|(_idx, line)| line.starts_with(prefix));
25 33
26 'outer: for (is_comment, block) in comment_blocks.into_iter() { 34 'outer: for (is_comment, block) in comment_blocks.into_iter() {
27 if !is_comment { 35 if !is_comment {
diff --git a/tools/src/main.rs b/tools/src/main.rs
index 671f05388..783e3395b 100644
--- a/tools/src/main.rs
+++ b/tools/src/main.rs
@@ -96,13 +96,6 @@ fn gen_tests(verify: bool) -> Result<()> {
96 Ok(()) 96 Ok(())
97} 97}
98 98
99
100impl ::std::hash::Hash for Test {
101 fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
102 self.name.hash(state)
103 }
104}
105
106fn tests_from_dir(dir: &Path) -> Result<HashSet<Test>> { 99fn tests_from_dir(dir: &Path) -> Result<HashSet<Test>> {
107 let mut res = HashSet::new(); 100 let mut res = HashSet::new();
108 for entry in ::walkdir::WalkDir::new(dir) { 101 for entry in ::walkdir::WalkDir::new(dir) {