Просмотр исходного кода

Fix clippy lint (#765)

* Fix clippy lint
Valentin Gosu 4 лет назад
Родитель
Сommit
cbc6a6d9a1
3 измененных файлов с 3 добавлено и 5 удалено
  1. 1 2
      form_urlencoded/src/lib.rs
  2. 1 2
      percent_encoding/src/lib.rs
  3. 1 1
      url/tests/unit.rs

+ 1 - 2
form_urlencoded/src/lib.rs

@@ -399,8 +399,7 @@ pub(crate) fn decode_utf8_lossy(input: Cow<'_, [u8]>) -> Cow<'_, str> {
                     // replace invalid bytes with a placeholder.
 
                     // First we do a debug_assert to confirm our description above.
-                    let raw_utf8: *const [u8];
-                    raw_utf8 = utf8.as_bytes();
+                    let raw_utf8: *const [u8] = utf8.as_bytes();
                     debug_assert!(raw_utf8 == &*bytes as *const [u8]);
 
                     // Given we know the original input bytes are valid UTF-8,

+ 1 - 2
percent_encoding/src/lib.rs

@@ -453,8 +453,7 @@ fn decode_utf8_lossy(input: Cow<'_, [u8]>) -> Cow<'_, str> {
                     // replace invalid bytes with a placeholder.
 
                     // First we do a debug_assert to confirm our description above.
-                    let raw_utf8: *const [u8];
-                    raw_utf8 = utf8.as_bytes();
+                    let raw_utf8: *const [u8] = utf8.as_bytes();
                     debug_assert!(raw_utf8 == &*bytes as *const [u8]);
 
                     // Given we know the original input bytes are valid UTF-8,

+ 1 - 1
url/tests/unit.rs

@@ -799,7 +799,7 @@ fn test_syntax_violation_callback_types() {
         ("file:/foo.txt", ExpectedFileDoubleSlash, "expected // after file:"),
         ("file://mozilla.org/c:/file.txt", FileWithHostAndWindowsDrive, "file: with host and Windows drive letter"),
         ("http://mozilla.org/^", NonUrlCodePoint, "non-URL code point"),
-        ("http://mozilla.org/#\00", NullInFragment, "NULL characters are ignored in URL fragment identifiers"),
+        ("http://mozilla.org/#\x000", NullInFragment, "NULL characters are ignored in URL fragment identifiers"),
         ("http://mozilla.org/%1", PercentDecode, "expected 2 hex digits after %"),
         ("http://mozilla.org\t/foo", TabOrNewlineIgnored, "tabs or newlines are ignored in URLs"),
         ("http://user@:pass@mozilla.org", UnencodedAtSign, "unencoded @ sign in username or password")