diff --git a/data-url/src/mime.rs b/data-url/src/mime.rs index a4c4f5aa4..b3e95bcba 100644 --- a/data-url/src/mime.rs +++ b/data-url/src/mime.rs @@ -17,8 +17,8 @@ impl Mime { { self.parameters .iter() - .find(|&&(ref n, _)| name == &**n) - .map(|&(_, ref v)| &**v) + .find(|&(n, _)| name == &**n) + .map(|(_, v)| &**v) } } @@ -124,7 +124,7 @@ fn parse_parameters(s: &str, parameters: &mut Vec<(String, String)>) { } fn contains(parameters: &[(String, String)], name: &str) -> bool { - parameters.iter().any(|&(ref n, _)| n == name) + parameters.iter().any(|(n, _)| n == name) } fn valid_value(s: &str) -> bool { @@ -140,7 +140,7 @@ impl fmt::Display for Mime { f.write_str(&self.type_)?; f.write_str("/")?; f.write_str(&self.subtype)?; - for &(ref name, ref value) in &self.parameters { + for (name, value) in &self.parameters { f.write_str(";")?; f.write_str(name)?; f.write_str("=")?; diff --git a/form_urlencoded/src/lib.rs b/form_urlencoded/src/lib.rs index 477594bf7..60ad2aafd 100644 --- a/form_urlencoded/src/lib.rs +++ b/form_urlencoded/src/lib.rs @@ -186,7 +186,7 @@ impl Target for String { impl<'a> Target for &'a mut String { fn as_mut_string(&mut self) -> &mut String { - &mut **self + self } fn finish(self) -> Self { self @@ -282,7 +282,7 @@ impl<'a, T: Target> Serializer<'a, T> { { let string = string(&mut self.target); for pair in iter { - let &(ref k, ref v) = pair.borrow(); + let (k, v) = pair.borrow(); append_pair( string, self.start_position, diff --git a/idna/src/uts46.rs b/idna/src/uts46.rs index ec2fd0b10..dc832fc49 100644 --- a/idna/src/uts46.rs +++ b/idna/src/uts46.rs @@ -274,7 +274,7 @@ fn passes_bidi(label: &str, is_bidi_domain: bool) -> bool { /// http://www.unicode.org/reports/tr46/#Validity_Criteria fn check_validity(label: &str, config: Config, errors: &mut Errors) { let first_char = label.chars().next(); - if first_char == None { + if first_char.is_none() { // Empty string, pass return; } @@ -475,7 +475,7 @@ impl Idna { /// http://www.unicode.org/reports/tr46/#ToASCII #[allow(clippy::wrong_self_convention)] - pub fn to_ascii<'a>(&'a mut self, domain: &str, out: &mut String) -> Result<(), Errors> { + pub fn to_ascii(&mut self, domain: &str, out: &mut String) -> Result<(), Errors> { let mut errors = self.to_ascii_inner(domain, out); if self.config.verify_dns_length { @@ -497,7 +497,7 @@ impl Idna { /// http://www.unicode.org/reports/tr46/#ToUnicode #[allow(clippy::wrong_self_convention)] - pub fn to_unicode<'a>(&'a mut self, domain: &str, out: &mut String) -> Result<(), Errors> { + pub fn to_unicode(&mut self, domain: &str, out: &mut String) -> Result<(), Errors> { if is_simple(domain) { out.push_str(domain); return Errors::default().into(); @@ -685,7 +685,7 @@ impl fmt::Debug for Errors { if !empty { f.write_str(", ")?; } - f.write_str(*name)?; + f.write_str(name)?; empty = false; } } diff --git a/idna/tests/punycode.rs b/idna/tests/punycode.rs index 1a51cbc92..95674137a 100644 --- a/idna/tests/punycode.rs +++ b/idna/tests/punycode.rs @@ -41,7 +41,7 @@ fn one_test(decoded: &str, encoded: &str) { fn get_string<'a>(map: &'a Map, key: &str) -> &'a str { match map.get(&key.to_string()) { - Some(&Value::String(ref s)) => s, + Some(Value::String(s)) => s, None => "", _ => panic!(), } diff --git a/url/src/lib.rs b/url/src/lib.rs index 32c02e396..fdcb3c063 100644 --- a/url/src/lib.rs +++ b/url/src/lib.rs @@ -601,7 +601,7 @@ impl Url { } assert!(self.scheme_end >= 1); - assert!(matches!(self.byte_at(0), b'a'..=b'z' | b'A'..=b'Z')); + assert!(self.byte_at(0).is_ascii_alphabetic()); assert!(self .slice(1..self.scheme_end) .chars() @@ -2848,7 +2848,7 @@ fn file_url_segments_to_pathbuf( // A windows drive letter must end with a slash. if bytes.len() > 2 - && matches!(bytes[bytes.len() - 2], b'a'..=b'z' | b'A'..=b'Z') + && bytes[bytes.len() - 2].is_ascii_alphabetic() && matches!(bytes[bytes.len() - 1], b':' | b'|') { bytes.push(b'/'); diff --git a/url/src/parser.rs b/url/src/parser.rs index f5438c505..458d3a9e8 100644 --- a/url/src/parser.rs +++ b/url/src/parser.rs @@ -1156,7 +1156,7 @@ impl<'a> Parser<'a> { return input; } - if maybe_c != None && maybe_c != Some('/') { + if maybe_c.is_some() && maybe_c != Some('/') { self.serialization.push('/'); } // Otherwise, if c is not the EOF code point: @@ -1534,7 +1534,7 @@ fn ascii_tab_or_new_line(ch: char) -> bool { /// https://url.spec.whatwg.org/#ascii-alpha #[inline] pub fn ascii_alpha(ch: char) -> bool { - matches!(ch, 'a'..='z' | 'A'..='Z') + ch.is_ascii_alphabetic() } #[inline] diff --git a/url/tests/data.rs b/url/tests/data.rs index f4001ca2b..7606985a4 100644 --- a/url/tests/data.rs +++ b/url/tests/data.rs @@ -228,7 +228,7 @@ fn get<'a>(url: &'a Url, attr: &str) -> &'a str { } #[allow(clippy::unit_arg)] -fn set<'a>(url: &'a mut Url, attr: &str, new: &str) { +fn set(url: &mut Url, attr: &str, new: &str) { let _ = match attr { "protocol" => quirks::set_protocol(url, new), "username" => quirks::set_username(url, new),