Clean up clippy lints
diff --git a/src/attr.rs b/src/attr.rs
index e41e8e7..8a16982 100644
--- a/src/attr.rs
+++ b/src/attr.rs
@@ -29,8 +29,8 @@
impl MetaItem {
pub fn name(&self) -> &str {
match *self {
- MetaItem::Word(ref name) => name.as_ref(),
- MetaItem::List(ref name, _) => name.as_ref(),
+ MetaItem::Word(ref name) |
+ MetaItem::List(ref name, _) |
MetaItem::NameValue(ref name, _) => name.as_ref(),
}
}
diff --git a/src/escape.rs b/src/escape.rs
index 3ff52e3..67fed92 100644
--- a/src/escape.rs
+++ b/src/escape.rs
@@ -61,7 +61,7 @@
_ => return IResult::Error,
}
}
- while let Some((byte_offset, ch)) = chars.next() {
+ for (byte_offset, ch) in chars {
if ch == '"' && input[byte_offset + 1..].starts_with(&input[..n]) {
let rest = &input[byte_offset + 1 + n..];
let value = &input[n + 1 .. byte_offset];
@@ -83,13 +83,14 @@
};
}
+#[cfg_attr(feature = "clippy", allow(diverging_sub_expression))]
fn backslash_x<I>(chars: &mut I) -> Option<char> where I: Iterator<Item = (usize, char)> {
let a = next_char!(chars @ '0'...'7');
let b = next_char!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F');
char_from_hex_bytes(&[a as u8, b as u8])
}
-#[cfg_attr(feature = "clippy", allow(many_single_char_names))]
+#[cfg_attr(feature = "clippy", allow(diverging_sub_expression, many_single_char_names))]
fn backslash_u<I>(chars: &mut I) -> Option<char> where I: Iterator<Item = (usize, char)> {
next_char!(chars @ '{');
let a = next_char!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F');
diff --git a/src/helper.rs b/src/helper.rs
index 855a3cc..5086c3d 100644
--- a/src/helper.rs
+++ b/src/helper.rs
@@ -40,7 +40,7 @@
}
}
-pub fn word_break<'a>(input: &'a str) -> IResult<&'a str, ()> {
+pub fn word_break(input: &str) -> IResult<&str, ()> {
match input.chars().next() {
Some(ch) if UnicodeXID::is_xid_continue(ch) => {
IResult::Error