From a59972bb8aa4625780ba367eca165e3d541250ab Mon Sep 17 00:00:00 2001 From: Erdem Meydanli Date: Tue, 9 Apr 2024 09:41:26 +0000 Subject: [PATCH] clippy/cargo: resolve build errors and warnings This commit resolves all errors and warnings that surfaced after upgrading from rustc v1.60 to v1.68.2. Signed-off-by: Erdem Meydanli --- vsock_proxy/src/dns.rs | 9 +++------ vsock_proxy/src/lib.rs | 8 ++++---- vsock_proxy/src/main.rs | 9 ++++++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/vsock_proxy/src/dns.rs b/vsock_proxy/src/dns.rs index 262a782fb..97c8f32df 100644 --- a/vsock_proxy/src/dns.rs +++ b/vsock_proxy/src/dns.rs @@ -9,7 +9,7 @@ use dns_lookup::lookup_host; use idna::domain_to_ascii; use std::net::IpAddr; -use crate::{IpAddrType, VsockProxyResult, DnsResolveResult}; +use crate::{DnsResolveResult, IpAddrType, VsockProxyResult}; /// Resolve a DNS name (IDNA format) into multiple IP addresses (v4 or v6) pub fn resolve(addr: &str, ip_addr_type: IpAddrType) -> VsockProxyResult> { @@ -55,8 +55,5 @@ pub fn resolve_single(addr: &str, ip_addr_type: IpAddrType) -> VsockProxyResult< let ip = *addrs.first().ok_or("No IP address found")?; let ttl = 60; // IMPORTANT TODO: Obtain this value dynamically - Ok(DnsResolveResult { - ip, - ttl - }) -} \ No newline at end of file + Ok(DnsResolveResult { ip, ttl }) +} diff --git a/vsock_proxy/src/lib.rs b/vsock_proxy/src/lib.rs index f9c8c0a8d..4f5192e0d 100644 --- a/vsock_proxy/src/lib.rs +++ b/vsock_proxy/src/lib.rs @@ -1,8 +1,8 @@ // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -pub mod proxy; pub mod dns; +pub mod proxy; use std::net::IpAddr; @@ -13,15 +13,15 @@ pub enum IpAddrType { /// Only allows IP6 addresses IPAddrV6Only, /// Allows both IP4 and IP6 addresses - IPAddrMixed + IPAddrMixed, } pub struct DnsResolveResult { ///Resolved address pub ip: IpAddr, ///DNS TTL value - pub ttl: u32 + pub ttl: u32, } /// The most common result type provided by VsockProxy operations. -pub type VsockProxyResult = Result; \ No newline at end of file +pub type VsockProxyResult = Result; diff --git a/vsock_proxy/src/main.rs b/vsock_proxy/src/main.rs index 9fd78cf2b..142465ede 100644 --- a/vsock_proxy/src/main.rs +++ b/vsock_proxy/src/main.rs @@ -10,7 +10,10 @@ use clap::{App, AppSettings, Arg}; use env_logger::init; use log::info; -use vsock_proxy::{proxy::{check_allowlist, Proxy}, IpAddrType, VsockProxyResult}; +use vsock_proxy::{ + proxy::{check_allowlist, Proxy}, + IpAddrType, VsockProxyResult, +}; fn main() -> VsockProxyResult<()> { init(); @@ -77,7 +80,7 @@ fn main() -> VsockProxyResult<()> { let ipv4_only = matches.is_present("ipv4"); let ipv6_only = matches.is_present("ipv6"); - let ip_addr_type : IpAddrType = match (ipv4_only, ipv6_only) { + let ip_addr_type: IpAddrType = match (ipv4_only, ipv6_only) { (true, false) => IpAddrType::IPAddrV4Only, (false, true) => IpAddrType::IPAddrV6Only, _ => IpAddrType::IPAddrMixed, @@ -119,7 +122,7 @@ fn main() -> VsockProxyResult<()> { remote_host, remote_port, num_workers, - ip_addr_type + ip_addr_type, ) .map_err(|err| format!("Could not create proxy: {}", err))?;