From 1732f40534ea72351c08f365b41c6228d8ae07b8 Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 17 Feb 2024 10:48:45 +0100 Subject: [PATCH] actually use filename from config --- src/config.rs | 2 +- src/law/mod.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config.rs b/src/config.rs index 2a07c21..3b57504 100644 --- a/src/config.rs +++ b/src/config.rs @@ -59,7 +59,7 @@ impl Config { let config_str = fs::read_to_string(path)?; let config: Config = toml::from_str(&config_str)?; - let mut builder = LawBuilder::new(); + let mut builder = LawBuilder::new(config.law.name); for classifier in config.law.classifiers { let to_add = law::Classifier::new( &classifier.name, diff --git a/src/law/mod.rs b/src/law/mod.rs index 6594287..b711cb3 100644 --- a/src/law/mod.rs +++ b/src/law/mod.rs @@ -166,15 +166,15 @@ impl PartialEq for LawBuilder { impl Default for LawBuilder { fn default() -> Self { - Self::new() + Self::new("".into()) } } impl LawBuilder { /// Creates a new law builder. Adds classifier for known law texts. - pub fn new() -> Self { + pub fn new(name: String) -> Self { Self { - name: "".into(), + name, classifiers: Vec::new(), header: Vec::new(), next_para_header: None,