langtool: Update, fix clippy warnings, just because

This commit is contained in:
Henrik Rydgård 2023-03-12 12:26:26 +01:00
parent 25fbfd7a89
commit ddab8fc0db
4 changed files with 19 additions and 21 deletions

View File

@ -76,9 +76,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.139"
version = "0.2.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
[[package]]
name = "proc-macro-error"
@ -106,9 +106,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.50"
version = "1.0.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
dependencies = [
"unicode-ident",
]
@ -154,9 +154,9 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.107"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
@ -174,9 +174,9 @@ dependencies = [
[[package]]
name = "unicode-ident"
version = "1.0.6"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
[[package]]
name = "unicode-segmentation"

View File

@ -5,4 +5,4 @@ name = "langtool"
version = "0.1.0"
[dependencies]
structopt = "0.3"
structopt = "0.3.26"

View File

@ -100,7 +100,7 @@ fn move_key(target_ini: &mut IniFile, old: &str, new: &str, key: &str) -> io::Re
fn remove_key(target_ini: &mut IniFile, section: &str, key: &str) -> io::Result<()> {
if let Some(old_section) = target_ini.get_section_mut(section) {
let _ = old_section.remove_line(key);
old_section.remove_line(key);
} else {
println!("No section {}", section);
}
@ -109,7 +109,7 @@ fn remove_key(target_ini: &mut IniFile, section: &str, key: &str) -> io::Result<
fn add_new_key(target_ini: &mut IniFile, section: &str, key: &str) -> io::Result<()> {
if let Some(section) = target_ini.get_section_mut(section) {
let _ = section.insert_line_if_missing(&format!("{} = {}", key, key));
section.insert_line_if_missing(&format!("{} = {}", key, key));
} else {
println!("No section {}", section);
}
@ -118,7 +118,7 @@ fn add_new_key(target_ini: &mut IniFile, section: &str, key: &str) -> io::Result
fn rename_key(target_ini: &mut IniFile, section: &str, old: &str, new: &str) -> io::Result<()> {
if let Some(section) = target_ini.get_section_mut(section) {
let _ = section.rename_key(old, new);
section.rename_key(old, new);
} else {
println!("No section {}", section);
}
@ -178,13 +178,13 @@ fn main() {
match opt.cmd {
Command::CopyMissingLines {} => {
copy_missing_lines(&reference_ini, &mut target_ini).unwrap();
copy_missing_lines(reference_ini, &mut target_ini).unwrap();
}
Command::CommentUnknownLines {} => {
deal_with_unknown_lines(&reference_ini, &mut target_ini, false).unwrap();
deal_with_unknown_lines(reference_ini, &mut target_ini, false).unwrap();
}
Command::RemoveUnknownLines {} => {
deal_with_unknown_lines(&reference_ini, &mut target_ini, true).unwrap();
deal_with_unknown_lines(reference_ini, &mut target_ini, true).unwrap();
}
Command::SortSection { ref section } => sort_section(&mut target_ini, section).unwrap(),
Command::RenameKey {

View File

@ -20,7 +20,7 @@ impl Section {
continue;
};
if prefix.eq_ignore_ascii_case(&key) {
if prefix.eq_ignore_ascii_case(key) {
remove_index = Some(index);
break;
}
@ -140,11 +140,9 @@ impl Section {
if prefix.starts_with("Font") || prefix.starts_with('#') {
return true;
}
if !other.lines.iter().any(|line| line.starts_with(prefix)) {
false
} else {
true
}
// keeps the line if this expression returns true.
other.lines.iter().any(|line| line.starts_with(prefix))
});
}
}