diff --git a/Cargo.lock b/Cargo.lock index a37cae6..f7cac10 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -97,12 +97,9 @@ checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "7f9fa1897e4325be0d68d48df6aa1a71ac2ed4d27723887e7754192705350730" [[package]] name = "cfg-if" @@ -527,6 +524,7 @@ dependencies = [ [[package]] name = "risp" version = "0.1.0" +source = "git+https://git.hofer.link/philipp/risp.git#ad8d5d828e508bd2186e3b6a8ad6f92c6e1baf67" dependencies = [ "clap", "directories", diff --git a/src/law.rs b/src/law.rs index cc4e864..0b2994e 100644 --- a/src/law.rs +++ b/src/law.rs @@ -39,10 +39,10 @@ fn print_paragraph(section: Section) -> String { ret.push_str("
"); ret.push_str(&format!("{}", section.symb)); if let Some(par_header) = section.par_header { - ret.push_str(&format!("{}", par_header)); + ret.push_str(&format!("{par_header}")); } if let Some(note) = section.par_note { - ret.push_str(&format!("Beachte: {}", note)); + ret.push_str(&format!("Beachte: {note}")); } ret.push_str(&print_content(section.content)); @@ -54,7 +54,7 @@ fn print_header(header: Heading, level: usize) -> String { let mut ret = String::new(); let mut header_title = header.name.clone(); if let Some(desc) = header.desc { - header_title.push_str(&format!(" ({desc})")) + header_title.push_str(&format!(" ({desc})")); } ret.push_str(&format!( @@ -96,15 +96,15 @@ fn get_content(config_path: &str) -> (String, String) { pub(crate) fn create_law_files() -> String { let mut configs: Vec<_> = fs::read_dir("./laws") .unwrap() - .map(|r| r.unwrap()) + .map(std::result::Result::unwrap) .collect(); - configs.sort_by_key(|dir| dir.path()); // Order by name - // + configs.sort_by_key(std::fs::DirEntry::path); // Order by name + let mut li_of_files = String::new(); for config in configs { let filename = config.file_name().into_string().unwrap(); //TODO: use proper logic... - let law_name = filename.replace(".toml", ""); + let law_filename = filename.replace(".toml", ""); let path = format!("{}", config.path().display()); let (lawname, content) = get_content(&path); @@ -117,9 +117,9 @@ pub(crate) fn create_law_files() -> String { let site = Parts::new().perform(site); li_of_files.push_str(&format!( - "
  • {lawname}
  • " + "
  • {lawname}
  • " )); - fs::write(&format!("output/{law_name}.html"), &site).expect("Unable to write file"); + fs::write(&format!("output/{law_filename}.html"), &site).expect("Unable to write file"); } li_of_files diff --git a/src/part.rs b/src/part.rs index 3770570..a7e01af 100644 --- a/src/part.rs +++ b/src/part.rs @@ -24,7 +24,7 @@ impl Parts { pub(crate) fn perform(&self, input: String) -> String { let mut input = input; for (key, value) in &self.parts { - let replace = format!("{{{{{}}}}}", key); + let replace = format!("{{{{{key}}}}}"); input = input.replace(&replace, value); } input