mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-21 16:41:01 -05:00
fix: Clippy
This commit is contained in:
parent
9f198c973d
commit
9ccfc9c27d
4 changed files with 6 additions and 7 deletions
|
@ -1,5 +1,6 @@
|
||||||
include!(concat!(env!("OUT_DIR"), "/codegen.rs"));
|
include!(concat!(env!("OUT_DIR"), "/codegen.rs"));
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct Dictionary {}
|
pub struct Dictionary {}
|
||||||
|
|
||||||
impl Dictionary {
|
impl Dictionary {
|
||||||
|
@ -29,6 +30,6 @@ fn map_lookup(
|
||||||
// See https://github.com/rust-lang/rust/issues/28853#issuecomment-158735548
|
// See https://github.com/rust-lang/rust/issues/28853#issuecomment-158735548
|
||||||
unsafe {
|
unsafe {
|
||||||
let key = ::std::mem::transmute::<_, &'static str>(key);
|
let key = ::std::mem::transmute::<_, &'static str>(key);
|
||||||
map.get(&UniCase(key)).map(|s| *s)
|
map.get(&UniCase(key)).cloned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ pub fn process_file(
|
||||||
for (line_idx, line) in grep_searcher::LineIter::new(b'\n', &buffer).enumerate() {
|
for (line_idx, line) in grep_searcher::LineIter::new(b'\n', &buffer).enumerate() {
|
||||||
let line_num = line_idx + 1;
|
let line_num = line_idx + 1;
|
||||||
for token in tokens::Symbol::parse(line) {
|
for token in tokens::Symbol::parse(line) {
|
||||||
if let Some(word) = std::str::from_utf8(token.token).ok() {
|
if let Ok(word) = std::str::from_utf8(token.token) {
|
||||||
// Correct tokens as-is
|
// Correct tokens as-is
|
||||||
if let Some(correction) = dictionary.correct_str(word) {
|
if let Some(correction) = dictionary.correct_str(word) {
|
||||||
let col_num = token.offset;
|
let col_num = token.offset;
|
||||||
|
|
|
@ -51,10 +51,8 @@ struct Options {
|
||||||
|
|
||||||
impl Options {
|
impl Options {
|
||||||
pub fn infer(mut self) -> Self {
|
pub fn infer(mut self) -> Self {
|
||||||
if self.path.len() == 1 {
|
if self.path.len() == 1 && self.path[0].is_file() {
|
||||||
if self.path[0].is_file() {
|
self.threads = 1;
|
||||||
self.threads = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
self
|
||||||
|
|
|
@ -9,7 +9,7 @@ impl<'t> Symbol<'t> {
|
||||||
Self { token, offset }
|
Self { token, offset }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse<'s>(content: &'s [u8]) -> impl Iterator<Item = Symbol<'s>> {
|
pub fn parse(content: &[u8]) -> impl Iterator<Item = Symbol<'_>> {
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
static ref SPLIT: regex::bytes::Regex = regex::bytes::Regex::new(r#"\b(\p{Alphabetic}|\d|_)+\b"#).unwrap();
|
static ref SPLIT: regex::bytes::Regex = regex::bytes::Regex::new(r#"\b(\p{Alphabetic}|\d|_)+\b"#).unwrap();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue