mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-29 04:21:06 -05:00
style: Address clippy
This commit is contained in:
parent
42d398fd5f
commit
f40ed5a328
1 changed files with 20 additions and 21 deletions
|
@ -137,14 +137,14 @@ impl<'s> Iterator for Utf8Chunks<'s> {
|
||||||
type Item = &'s str;
|
type Item = &'s str;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<&'s str> {
|
fn next(&mut self) -> Option<&'s str> {
|
||||||
loop {
|
|
||||||
if self.source.is_empty() {
|
if self.source.is_empty() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
match simdutf8::compat::from_utf8(self.source) {
|
match simdutf8::compat::from_utf8(self.source) {
|
||||||
Ok(valid) => {
|
Ok(valid) => {
|
||||||
self.source = b"";
|
self.source = b"";
|
||||||
return Some(valid);
|
Some(valid)
|
||||||
}
|
}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
let (valid, after_valid) = self.source.split_at(error.valid_up_to());
|
let (valid, after_valid) = self.source.split_at(error.valid_up_to());
|
||||||
|
@ -156,8 +156,7 @@ impl<'s> Iterator for Utf8Chunks<'s> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let valid = unsafe { std::str::from_utf8_unchecked(valid) };
|
let valid = unsafe { std::str::from_utf8_unchecked(valid) };
|
||||||
return Some(valid);
|
Some(valid)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,7 +216,7 @@ mod unicode_parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn literal_sep(input: &str) -> IResult<&str, &str> {
|
fn literal_sep(input: &str) -> IResult<&str, &str> {
|
||||||
take_till(|c: char| unicode_xid::UnicodeXID::is_xid_continue(c))(input)
|
take_till(unicode_xid::UnicodeXID::is_xid_continue)(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn identifier(input: &str) -> IResult<&str, &str> {
|
fn identifier(input: &str) -> IResult<&str, &str> {
|
||||||
|
@ -225,7 +224,7 @@ mod unicode_parser {
|
||||||
// `{XID_Continue}+` because XID_Continue is a superset of XID_Start and rather catch odd
|
// `{XID_Continue}+` because XID_Continue is a superset of XID_Start and rather catch odd
|
||||||
// or unexpected cases than strip off start characters to a word since we aren't doing a
|
// or unexpected cases than strip off start characters to a word since we aren't doing a
|
||||||
// proper word boundary parse
|
// proper word boundary parse
|
||||||
take_while1(|c: char| unicode_xid::UnicodeXID::is_xid_continue(c))(input)
|
take_while1(unicode_xid::UnicodeXID::is_xid_continue)(input)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +252,7 @@ mod ascii_parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn literal_sep(input: &[u8]) -> IResult<&[u8], &[u8]> {
|
fn literal_sep(input: &[u8]) -> IResult<&[u8], &[u8]> {
|
||||||
take_till(|c: u8| is_continue(c))(input)
|
take_till(is_continue)(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn identifier(input: &[u8]) -> IResult<&[u8], &[u8]> {
|
fn identifier(input: &[u8]) -> IResult<&[u8], &[u8]> {
|
||||||
|
@ -261,7 +260,7 @@ mod ascii_parser {
|
||||||
// `{XID_Continue}+` because XID_Continue is a superset of XID_Start and rather catch odd
|
// `{XID_Continue}+` because XID_Continue is a superset of XID_Start and rather catch odd
|
||||||
// or unexpected cases than strip off start characters to a word since we aren't doing a
|
// or unexpected cases than strip off start characters to a word since we aren't doing a
|
||||||
// proper word boundary parse
|
// proper word boundary parse
|
||||||
take_while1(|c: u8| is_continue(c))(input)
|
take_while1(is_continue)(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_continue(c: u8) -> bool {
|
fn is_continue(c: u8) -> bool {
|
||||||
|
|
Loading…
Reference in a new issue