Fix linter warnings from Clippy

This commit is contained in:
Joakim Soderlund 2019-08-10 22:33:05 +00:00
parent f6f9f815ad
commit f0d7380fa6
2 changed files with 13 additions and 13 deletions

View file

@ -38,7 +38,7 @@ fn strfn(f: StrFn, op: Operator, value: &str) -> Result<Filter> {
};
match op {
Exact => ok!(move |s| f(s) == &value),
Exact => ok!(move |s| f(s) == value),
Fuzzy => ok!(move |s| f(s).to_lowercase().contains(&value)),
_ => Err(Error::query("Invalid operation for text type")),
}
@ -68,7 +68,7 @@ fn dtufn(f: DtuFn, op: Operator, value: &str) -> Result<Filter> {
match op {
Exact => ok!(move |s| match f(s) {
Some(dt) => dt == &value,
Some(dt) => *dt == value,
None => false,
}),
Fuzzy => ok!(move |s| match f(s) {
@ -76,11 +76,11 @@ fn dtufn(f: DtuFn, op: Operator, value: &str) -> Result<Filter> {
None => false,
}),
LessThan => ok!(move |s| match f(s) {
Some(dt) => dt < &value,
Some(dt) => *dt < value,
None => false,
}),
MoreThan => ok!(move |s| match f(s) {
Some(dt) => dt > &value,
Some(dt) => *dt > value,
None => false,
}),
}

View file

@ -45,7 +45,7 @@ macro_rules! dfn {
}
named!(source<&str, Source>, preceded!(space0, alt!(
tag!("id") => { ifn!(|s| s.id as i64) } |
tag!("id") => { ifn!(|s| s.id) } |
tag!("story") => { sfn!(|s| &s.title) } |
tag!("title") => { sfn!(|s| &s.title) } |
@ -58,18 +58,18 @@ named!(source<&str, Source>, preceded!(space0, alt!(
tag!("published") => { dfn!(|s| &s.date_published) } |
tag!("updated") => { dfn!(|s| &s.date_updated) } |
tag!("chapters") => { ifn!(|s| s.num_chapters as i64) } |
tag!("comments") => { ifn!(|s| s.num_comments as i64) } |
tag!("dislikes") => { ifn!(|s| s.num_dislikes as i64) } |
tag!("likes") => { ifn!(|s| s.num_likes as i64) } |
tag!("total views") => { ifn!(|s| s.total_num_views as i64) } |
tag!("views") => { ifn!(|s| s.num_views as i64) } |
tag!("words") => { ifn!(|s| s.num_words as i64) } |
tag!("chapters") => { ifn!(|s| i64::from(s.num_chapters)) } |
tag!("comments") => { ifn!(|s| i64::from(s.num_comments)) } |
tag!("dislikes") => { ifn!(|s| i64::from(s.num_dislikes)) } |
tag!("likes") => { ifn!(|s| i64::from(s.num_likes)) } |
tag!("total views") => { ifn!(|s| i64::from(s.total_num_views)) } |
tag!("views") => { ifn!(|s| i64::from(s.num_views)) } |
tag!("words") => { ifn!(|s| i64::from(s.num_words)) } |
tag!("author") => { sfn!(|s| &s.author.name) } |
tag!("author name") => { sfn!(|s| &s.author.name) } |
tag!("author id") => { ifn!(|s| s.author.id as i64) } |
tag!("author id") => { ifn!(|s| s.author.id) } |
tag!("author joined") => { dfn!(|s| &s.author.date_joined) } |
tag!("path") => { sfn!(|s| &s.archive.path) } |