diff --git a/crates/misspell-dict/codegen/src/main.rs b/crates/misspell-dict/codegen/src/main.rs index d0126ed..a290883 100644 --- a/crates/misspell-dict/codegen/src/main.rs +++ b/crates/misspell-dict/codegen/src/main.rs @@ -20,7 +20,7 @@ fn parse_dict(raw: &str) -> Words { let mut current = &mut bad; for line in raw.lines() { - let line = line.splitn(2, "//").next().unwrap().trim(); + let line = line.split_once("//").map(|l| l.0).unwrap_or(line).trim(); if line.is_empty() || line.starts_with("package") { continue; } else if line.contains("DictMain") { diff --git a/crates/varcon-core/src/borrowed.rs b/crates/varcon-core/src/borrowed.rs index 937c5dc..c73713a 100644 --- a/crates/varcon-core/src/borrowed.rs +++ b/crates/varcon-core/src/borrowed.rs @@ -47,7 +47,7 @@ pub struct Variant { impl Variant { pub fn into_owned(self) -> crate::Variant { crate::Variant { - types: self.types.iter().copied().collect(), + types: self.types.to_vec(), word: self.word.to_owned(), } } diff --git a/src/bin/typos-cli/report.rs b/src/bin/typos-cli/report.rs index d23d795..1eb6318 100644 --- a/src/bin/typos-cli/report.rs +++ b/src/bin/typos-cli/report.rs @@ -131,7 +131,7 @@ impl Report for PrintLong { fn print_brief_correction(msg: &Typo, palette: Palette) -> Result<(), std::io::Error> { let line = String::from_utf8_lossy(msg.buffer.as_ref()); - let line = line.replace("\t", " "); + let line = line.replace('\t', " "); let column = unicode_segmentation::UnicodeSegmentation::graphemes( line.get(0..msg.byte_offset).unwrap(), true, @@ -177,7 +177,7 @@ fn print_long_correction(msg: &Typo, palette: Palette) -> Result<(), std::io::Er let mut handle = stdout.lock(); let line = String::from_utf8_lossy(msg.buffer.as_ref()); - let line = line.replace("\t", " "); + let line = line.replace('\t', " "); let start = String::from_utf8_lossy(&msg.buffer[0..msg.byte_offset]); let column = unicode_segmentation::UnicodeSegmentation::graphemes(start.as_ref(), true).count(); match &msg.corrections {