clippy all codes (#1214)

1. clippy code
2. add fmt and clippy check in ci
This commit is contained in:
Sijie.Sun authored and GitHub committed 2025-08-10 22:56:41 +08:00
1 parent 0087ac3ffc
commit e43537939a
144 files changed
+1475 -1531

No files matched your search

+7 -7
View File
@@ -96,12 +96,12 @@ impl Server {
.0
.name_servers()
.iter()
.cloned()
.filter(|x| {
.filter(|&x| {
!config
.excluded_forward_nameservers()
.contains(&x.socket_addr.ip())
})
.cloned()
.collect::<Vec<_>>()
.into(),
options: Some(system_conf.1),
@@ -148,7 +148,7 @@ impl Server {
.with_context(|| {
format!(
"DNS Server failed to create UDP socket for address {}",
address.to_string()
address
)
})?;
socket2::SockRef::from(&socket)
@@ -156,7 +156,7 @@ impl Server {
.with_context(|| {
format!(
"DNS Server failed to set reuse address on socket {}",
address.to_string()
address
)
})?;
socket.bind(&bind_addr.into()).with_context(|| {
@@ -164,17 +164,17 @@ impl Server {
})?;
socket
.set_nonblocking(true)
.with_context(|| format!("DNS Server failed to set socket to non-blocking"))?;
.with_context(|| "DNS Server failed to set socket to non-blocking".to_string())?;
let socket = UdpSocket::from_std(socket.into()).with_context(|| {
format!(
"DNS Server failed to convert socket to UdpSocket for address {}",
address.to_string()
address
)
})?;
let local_addr = socket
.local_addr()
.with_context(|| format!("DNS Server failed to get local address"))?;
.with_context(|| "DNS Server failed to get local address".to_string())?;
self.server.register_socket(socket);
Ok(local_addr)