From 2826bdd75b31f42aac1c80b2302c25e739a8adf1 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sat, 10 Jul 2021 07:15:46 +0100 Subject: Clippy: don't nest module inside module with same name --- src/hunk_header.rs | 2 +- src/tests/test_example_diffs.rs | 2 +- src/tests/test_utils.rs | 26 ++++++++++++-------------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/hunk_header.rs b/src/hunk_header.rs index 5563030e..b72c1650 100644 --- a/src/hunk_header.rs +++ b/src/hunk_header.rs @@ -168,7 +168,7 @@ fn write_to_output_buffer( #[cfg(test)] pub mod tests { use super::*; - use crate::tests::integration_test_utils::integration_test_utils; + use crate::tests::integration_test_utils; #[test] fn test_get_painted_file_with_line_number_default() { diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs index d9e32ae4..1a1d9991 100644 --- a/src/tests/test_example_diffs.rs +++ b/src/tests/test_example_diffs.rs @@ -6,7 +6,7 @@ mod tests { use crate::style; use crate::tests::ansi_test_utils::ansi_test_utils; use crate::tests::integration_test_utils; - use crate::tests::test_utils::test_utils; + use crate::tests::test_utils; #[test] fn test_added_file() { diff --git a/src/tests/test_utils.rs b/src/tests/test_utils.rs index 9f66adfa..3e17c839 100644 --- a/src/tests/test_utils.rs +++ b/src/tests/test_utils.rs @@ -1,24 +1,22 @@ -#[cfg(test)] -pub mod test_utils { - /// Return true iff `s` contains exactly one occurrence of substring `t`. - pub fn contains_once(s: &str, t: &str) -> bool { - match (s.find(t), s.rfind(t)) { - (Some(i), Some(j)) => i == j, - _ => false, - } +#![cfg(test)] +/// Return true iff `s` contains exactly one occurrence of substring `t`. +pub fn contains_once(s: &str, t: &str) -> bool { + match (s.find(t), s.rfind(t)) { + (Some(i), Some(j)) => i == j, + _ => false, } +} - #[allow(dead_code)] - pub fn print_with_line_numbers(s: &str) { - for (i, t) in s.lines().enumerate() { - println!("{:>2}│ {}", i + 1, t); - } +#[allow(dead_code)] +pub fn print_with_line_numbers(s: &str) { + for (i, t) in s.lines().enumerate() { + println!("{:>2}│ {}", i + 1, t); } } #[cfg(test)] mod tests { - use crate::tests::test_utils::test_utils::*; + use crate::tests::test_utils::*; #[test] fn test_contains_once_1() { -- cgit v1.2.3