From 69c385e8105c7fad07a5728979e86a2a6a5e88ba Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Jul 2018 16:32:27 +0300 Subject: Fix compilation for real --- tools/src/lib.rs | 5 ++--- tools/src/main.rs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'tools/src') 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; #[derive(Debug, Eq)] pub struct Test { - pub start_line: usize, pub name: String, pub text: String, } @@ -22,7 +21,7 @@ impl hash::Hash for Test { } } -pub fn collect_tests(s: &str) -> Vec { +pub fn collect_tests(s: &str) -> Vec<(usize, Test)> { let mut res = vec![]; let prefix = "// "; let comment_blocks = s @@ -52,7 +51,7 @@ pub fn collect_tests(s: &str) -> Vec { "\n" ); assert!(!text.trim().is_empty() && text.ends_with("\n")); - res.push(Test { start_line, name, text }) + res.push((start_line, Test {name, text })) } res } 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> { } let text = fs::read_to_string(entry.path())?; - for test in collect_tests(&text) { + for (_, test) in collect_tests(&text) { if let Some(old_test) = res.replace(test) { bail!("Duplicate test: {}", old_test.name) } -- cgit v1.2.3