Loading crates/arti-client/src/address.rs +5 −6 Original line number Diff line number Diff line Loading @@ -240,7 +240,6 @@ impl TorAddr { } /// Get instructions for how to make a stream to this address #[allow(clippy::string_slice)] // TODO pub(crate) fn into_stream_instructions( self, cfg: &crate::config::ClientAddrConfig, Loading @@ -262,7 +261,9 @@ impl TorAddr { .nth(1) .map(|(i, _)| i + 1) .unwrap_or(0); let rhs = &onion[rhs..]; let rhs = onion .get(rhs..) .expect("character index was not a valid index!?"); let hsid = rhs.parse()?; StreamInstructions::Hs { hsid, Loading Loading @@ -491,9 +492,8 @@ impl IntoTorAddr for &str { } impl IntoTorAddr for String { #[allow(clippy::string_slice)] // TODO fn into_tor_addr(self) -> Result<TorAddr, TorAddrError> { self[..].into_tor_addr() self.as_str().into_tor_addr() } } Loading @@ -513,10 +513,9 @@ impl IntoTorAddr for (&str, u16) { } impl IntoTorAddr for (String, u16) { #[allow(clippy::string_slice)] // TODO fn into_tor_addr(self) -> Result<TorAddr, TorAddrError> { let (host, port) = self; (&host[..], port).into_tor_addr() (host.as_str(), port).into_tor_addr() } } Loading crates/tor-dirmgr/src/storage.rs +1 −2 Original line number Diff line number Diff line Loading @@ -100,14 +100,13 @@ impl InputString { } /// Helper for [`Self::as_str()`], with unwrapped error type. #[allow(clippy::string_slice)] // TODO fn as_str_impl(&self) -> std::result::Result<&str, Utf8Error> { // It is not necessary to re-check the UTF8 every time // this function is called so remember the result // we got with `validated` match self { InputString::Utf8(s) => Ok(&s[..]), InputString::Utf8(s) => Ok(s.as_ref()), InputString::UncheckedBytes { bytes, validated } => { if *validated.borrow() { unsafe { Ok(std::str::from_utf8_unchecked(&bytes[..])) } Loading Loading
crates/arti-client/src/address.rs +5 −6 Original line number Diff line number Diff line Loading @@ -240,7 +240,6 @@ impl TorAddr { } /// Get instructions for how to make a stream to this address #[allow(clippy::string_slice)] // TODO pub(crate) fn into_stream_instructions( self, cfg: &crate::config::ClientAddrConfig, Loading @@ -262,7 +261,9 @@ impl TorAddr { .nth(1) .map(|(i, _)| i + 1) .unwrap_or(0); let rhs = &onion[rhs..]; let rhs = onion .get(rhs..) .expect("character index was not a valid index!?"); let hsid = rhs.parse()?; StreamInstructions::Hs { hsid, Loading Loading @@ -491,9 +492,8 @@ impl IntoTorAddr for &str { } impl IntoTorAddr for String { #[allow(clippy::string_slice)] // TODO fn into_tor_addr(self) -> Result<TorAddr, TorAddrError> { self[..].into_tor_addr() self.as_str().into_tor_addr() } } Loading @@ -513,10 +513,9 @@ impl IntoTorAddr for (&str, u16) { } impl IntoTorAddr for (String, u16) { #[allow(clippy::string_slice)] // TODO fn into_tor_addr(self) -> Result<TorAddr, TorAddrError> { let (host, port) = self; (&host[..], port).into_tor_addr() (host.as_str(), port).into_tor_addr() } } Loading
crates/tor-dirmgr/src/storage.rs +1 −2 Original line number Diff line number Diff line Loading @@ -100,14 +100,13 @@ impl InputString { } /// Helper for [`Self::as_str()`], with unwrapped error type. #[allow(clippy::string_slice)] // TODO fn as_str_impl(&self) -> std::result::Result<&str, Utf8Error> { // It is not necessary to re-check the UTF8 every time // this function is called so remember the result // we got with `validated` match self { InputString::Utf8(s) => Ok(&s[..]), InputString::Utf8(s) => Ok(s.as_ref()), InputString::UncheckedBytes { bytes, validated } => { if *validated.borrow() { unsafe { Ok(std::str::from_utf8_unchecked(&bytes[..])) } Loading