diff --git a/Tools/langtool/Cargo.lock b/Tools/langtool/Cargo.lock index 2fadb455c5..e8dd042a50 100644 --- a/Tools/langtool/Cargo.lock +++ b/Tools/langtool/Cargo.lock @@ -76,9 +76,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.148" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "proc-macro-error" @@ -106,9 +106,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] diff --git a/Tools/langtool/src/inifile.rs b/Tools/langtool/src/inifile.rs index c70f4636ec..f0c23bd298 100644 --- a/Tools/langtool/src/inifile.rs +++ b/Tools/langtool/src/inifile.rs @@ -120,12 +120,9 @@ impl IniFile { } pub fn get_section_mut(&mut self, section_name: &str) -> Option<&mut Section> { - for section in &mut self.sections { - if section.name == section_name { - return Some(section); - } - } - None + self.sections + .iter_mut() + .find(|section| section.name == section_name) } } diff --git a/Tools/langtool/src/section.rs b/Tools/langtool/src/section.rs index ec07dfcc72..f845d60716 100644 --- a/Tools/langtool/src/section.rs +++ b/Tools/langtool/src/section.rs @@ -117,12 +117,10 @@ impl Section { if prefix.starts_with("Font") || prefix.starts_with('#') { continue; } - if !other.lines.iter().any(|line| line.starts_with(prefix)) { - if !prefix.contains("URL") { - println!("Commenting out from {}: {line}", other.name); - // Comment out the line. - *line = "#".to_owned() + line; - } + if !other.lines.iter().any(|line| line.starts_with(prefix)) && !prefix.contains("URL") { + println!("Commenting out from {}: {line}", other.name); + // Comment out the line. + *line = "#".to_owned() + line; } } }