From 8442397b8489991cbaeb6791f094d7ed8de15f6d Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Sun, 10 Apr 2022 21:50:24 +0200 Subject: [PATCH] lint(needless_late_init): decode_utf8_lossy --- form_urlencoded/src/lib.rs | 3 +-- percent_encoding/src/lib.rs | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/form_urlencoded/src/lib.rs b/form_urlencoded/src/lib.rs index b0916e42b..477594bf7 100644 --- a/form_urlencoded/src/lib.rs +++ b/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, diff --git a/percent_encoding/src/lib.rs b/percent_encoding/src/lib.rs index 2517ae820..46a5d747c 100644 --- a/percent_encoding/src/lib.rs +++ b/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,