From 0e7227e8037b34f456b451a45b6bdf98d1549490 Mon Sep 17 00:00:00 2001 From: renancloudwalk Date: Fri, 7 Jun 2024 09:03:22 -0300 Subject: [PATCH] lint --- src/eth/consensus/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/eth/consensus/mod.rs b/src/eth/consensus/mod.rs index 07c4bb761..00988a539 100644 --- a/src/eth/consensus/mod.rs +++ b/src/eth/consensus/mod.rs @@ -94,10 +94,10 @@ impl PeerAddress { } fn from_string(s: String) -> Result { - let (scheme, address_part) = if s.starts_with("http://") { - ("http://", &s[7..]) - } else if s.starts_with("https://") { - ("https://", &s[8..]) + let (scheme, address_part) = if let Some(address) = s.strip_prefix("http://") { + ("http://", address) + } else if let Some(address) = s.strip_prefix("https://") { + ("https://", address) } else { return Err(anyhow::anyhow!("invalid scheme")); };