mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-25 10:31:02 -05:00
style: Update clippy
This commit is contained in:
parent
bf2c277951
commit
86c54fffbf
3 changed files with 4 additions and 4 deletions
|
@ -20,7 +20,7 @@ fn parse_dict(raw: &str) -> Words {
|
||||||
|
|
||||||
let mut current = &mut bad;
|
let mut current = &mut bad;
|
||||||
for line in raw.lines() {
|
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") {
|
if line.is_empty() || line.starts_with("package") {
|
||||||
continue;
|
continue;
|
||||||
} else if line.contains("DictMain") {
|
} else if line.contains("DictMain") {
|
||||||
|
|
|
@ -47,7 +47,7 @@ pub struct Variant {
|
||||||
impl Variant {
|
impl Variant {
|
||||||
pub fn into_owned(self) -> crate::Variant {
|
pub fn into_owned(self) -> crate::Variant {
|
||||||
crate::Variant {
|
crate::Variant {
|
||||||
types: self.types.iter().copied().collect(),
|
types: self.types.to_vec(),
|
||||||
word: self.word.to_owned(),
|
word: self.word.to_owned(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ impl Report for PrintLong {
|
||||||
|
|
||||||
fn print_brief_correction(msg: &Typo, palette: Palette) -> Result<(), std::io::Error> {
|
fn print_brief_correction(msg: &Typo, palette: Palette) -> Result<(), std::io::Error> {
|
||||||
let line = String::from_utf8_lossy(msg.buffer.as_ref());
|
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(
|
let column = unicode_segmentation::UnicodeSegmentation::graphemes(
|
||||||
line.get(0..msg.byte_offset).unwrap(),
|
line.get(0..msg.byte_offset).unwrap(),
|
||||||
true,
|
true,
|
||||||
|
@ -177,7 +177,7 @@ fn print_long_correction(msg: &Typo, palette: Palette) -> Result<(), std::io::Er
|
||||||
let mut handle = stdout.lock();
|
let mut handle = stdout.lock();
|
||||||
|
|
||||||
let line = String::from_utf8_lossy(msg.buffer.as_ref());
|
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 start = String::from_utf8_lossy(&msg.buffer[0..msg.byte_offset]);
|
||||||
let column = unicode_segmentation::UnicodeSegmentation::graphemes(start.as_ref(), true).count();
|
let column = unicode_segmentation::UnicodeSegmentation::graphemes(start.as_ref(), true).count();
|
||||||
match &msg.corrections {
|
match &msg.corrections {
|
||||||
|
|
Loading…
Reference in a new issue