aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-07-30 14:32:27 +0100
committerAleksey Kladov <[email protected]>2018-07-30 14:32:27 +0100
commit69c385e8105c7fad07a5728979e86a2a6a5e88ba (patch)
tree10e58c3bc358d184139b897bada3800f37f6096d /tools
parent67424000a9decccda44f4303d00d91a4fca985ba (diff)
Fix compilation for real
Diffstat (limited to 'tools')
-rw-r--r--tools/src/lib.rs5
-rw-r--r--tools/src/main.rs2
2 files changed, 3 insertions, 4 deletions
diff --git a/tools/src/lib.rs b/tools/src/lib.rs
index 1b7ef3ca9..7a0de3e3c 100644
--- a/tools/src/lib.rs
+++ b/tools/src/lib.rs
@@ -5,7 +5,6 @@ use itertools::Itertools;
5 5
6#[derive(Debug, Eq)] 6#[derive(Debug, Eq)]
7pub struct Test { 7pub struct Test {
8 pub start_line: usize,
9 pub name: String, 8 pub name: String,
10 pub text: String, 9 pub text: String,
11} 10}
@@ -22,7 +21,7 @@ impl hash::Hash for Test {
22 } 21 }
23} 22}
24 23
25pub fn collect_tests(s: &str) -> Vec<Test> { 24pub fn collect_tests(s: &str) -> Vec<(usize, Test)> {
26 let mut res = vec![]; 25 let mut res = vec![];
27 let prefix = "// "; 26 let prefix = "// ";
28 let comment_blocks = s 27 let comment_blocks = s
@@ -52,7 +51,7 @@ pub fn collect_tests(s: &str) -> Vec<Test> {
52 "\n" 51 "\n"
53 ); 52 );
54 assert!(!text.trim().is_empty() && text.ends_with("\n")); 53 assert!(!text.trim().is_empty() && text.ends_with("\n"));
55 res.push(Test { start_line, name, text }) 54 res.push((start_line, Test {name, text }))
56 } 55 }
57 res 56 res
58} 57}
diff --git a/tools/src/main.rs b/tools/src/main.rs
index 783e3395b..6786b81ca 100644
--- a/tools/src/main.rs
+++ b/tools/src/main.rs
@@ -108,7 +108,7 @@ fn tests_from_dir(dir: &Path) -> Result<HashSet<Test>> {
108 } 108 }
109 let text = fs::read_to_string(entry.path())?; 109 let text = fs::read_to_string(entry.path())?;
110 110
111 for test in collect_tests(&text) { 111 for (_, test) in collect_tests(&text) {
112 if let Some(old_test) = res.replace(test) { 112 if let Some(old_test) = res.replace(test) {
113 bail!("Duplicate test: {}", old_test.name) 113 bail!("Duplicate test: {}", old_test.name)
114 } 114 }