Skip to content

Commit

Permalink
fix: Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jun 14, 2019
1 parent 9f198c9 commit 9ccfc9c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/dict.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include!(concat!(env!("OUT_DIR"), "/codegen.rs"));

#[derive(Default)]
pub struct Dictionary {}

impl Dictionary {
Expand Down Expand Up @@ -29,6 +30,6 @@ fn map_lookup(
// See https://github.com/rust-lang/rust/issues/28853#issuecomment-158735548
unsafe {
let key = ::std::mem::transmute::<_, &'static str>(key);
map.get(&UniCase(key)).map(|s| *s)
map.get(&UniCase(key)).cloned()
}
}
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub fn process_file(
for (line_idx, line) in grep_searcher::LineIter::new(b'\n', &buffer).enumerate() {
let line_num = line_idx + 1;
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
if let Some(correction) = dictionary.correct_str(word) {
let col_num = token.offset;
Expand Down
6 changes: 2 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ struct Options {

impl Options {
pub fn infer(mut self) -> Self {
if self.path.len() == 1 {
if self.path[0].is_file() {
self.threads = 1;
}
if self.path.len() == 1 && self.path[0].is_file() {
self.threads = 1;
}

self
Expand Down
2 changes: 1 addition & 1 deletion src/tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ impl<'t> Symbol<'t> {
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! {
static ref SPLIT: regex::bytes::Regex = regex::bytes::Regex::new(r#"\b(\p{Alphabetic}|\d|_)+\b"#).unwrap();
}
Expand Down

0 comments on commit 9ccfc9c

Please sign in to comment.