diff options
author | flip1995 <hello@philkrones.com> | 2019-08-27 10:28:16 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2019-08-28 18:18:41 +0200 |
commit | c8a7aacf991c77f83734e7e9d4ee8e77c8d60665 (patch) | |
tree | f69cb7d82f6080515c2af16fc50da1f9411fb6d0 | |
parent | fae9f82c67aeb8d86ea66489e106f47c65f72ef5 (diff) |
[No-auto] lib/entry/tag: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | lib/entry/libimagentrytag/src/tag.rs | 10 | ||||
-rw-r--r-- | lib/entry/libimagentrytag/src/tagable.rs | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/entry/libimagentrytag/src/tag.rs b/lib/entry/libimagentrytag/src/tag.rs index 58573cef..3cba2016 100644 --- a/lib/entry/libimagentrytag/src/tag.rs +++ b/lib/entry/libimagentrytag/src/tag.rs @@ -29,15 +29,15 @@ pub fn is_tag(s: String) -> Result<(), String> { is_tag_str(&s).map_err(|_| format!("The string '{}' is not a valid tag", s)) } -pub fn is_tag_str(s: &String) -> Result<(), Error> { +pub fn is_tag_str(s: &str) -> Result<(), Error> { use filters::filter::Filter; trace!("Checking whether '{}' is a valid tag", s); - let is_lower = |s: &String| s.chars().all(|c| c.is_lowercase()); - let no_whitespace = |s: &String| s.chars().all(|c| !c.is_whitespace()); - let is_alphanum = |s: &String| s.chars().all(|c| c.is_alphanumeric()); + let is_lower = |s: &&str| s.chars().all(|c| c.is_lowercase()); + let no_whitespace = |s: &&str| s.chars().all(|c| !c.is_whitespace()); + let is_alphanum = |s: &&str| s.chars().all(|c| c.is_alphanumeric()); - if is_lower.and(no_whitespace).and(is_alphanum).filter(s) { + if is_lower.and(no_whitespace).and(is_alphanum).filter(&s) { Ok(()) } else { Err(format_err!("The string '{}' is not a valid tag", s)) diff --git a/lib/entry/libimagentrytag/src/tagable.rs b/lib/entry/libimagentrytag/src/tagable.rs index 51dd7c04..f6d8d6b1 100644 --- a/lib/entry/libimagentrytag/src/tagable.rs +++ b/lib/entry/libimagentrytag/src/tagable.rs @@ -62,7 +62,7 @@ impl Tagable for Entry { .map(|header| { header.values .iter() - .map(is_tag_str) + .map(|val| is_tag_str(val)) .collect::<Result<_>>()?; Ok(header.values) @@ -73,7 +73,7 @@ impl Tagable for Entry { fn set_tags(&mut self, ts: &[Tag]) -> Result<()> { let _ = ts .iter() - .map(is_tag_str) + .map(|val| is_tag_str(val)) .collect::<Result<Vec<_>>>()?; let header = TagHeader { |