From 71e34cc04258862ab4ef7177c2719ca3ec8bedcf Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Thu, 3 Oct 2024 21:33:22 -0700 Subject: [PATCH] Name the DEFAULT_CONFIG --- src/lib.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e8a2ea0..74a54a2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,6 +32,11 @@ impl Config { } } +const DEFAULT_CONFIG: Config = Config { + column_threshold: 2, + static_columns: vec![], +}; + const HEADER: &str = r#" @@ -208,10 +213,7 @@ impl<'cfg, Input: Iterator>> Iterator } fn read_input(input: impl std::io::Read) -> Result<(Vec, Config), std::io::Error> { - let mut config = Config { - column_threshold: 2, - static_columns: vec![], - }; + let mut config = DEFAULT_CONFIG; let reader = Reader::new(&mut config, std::io::BufReader::new(input).lines()); reader .collect::, _>>() @@ -722,10 +724,7 @@ mod tests { fn test_render_row() { assert_eq!( render_row( - &Config { - column_threshold: 0, - static_columns: vec![], - }, + &DEFAULT_CONFIG, &["foo".to_owned()], &mut Rowlike::Row(Row { label: "nope".to_owned(), -- 2.44.1