Skip to content

Commit fcb871c

Browse files
authored
Merge pull request #1499 from hermit-os/clippy-dns
fix: run clippy on `feature = "dns"`
2 parents e5ea9ac + 22476ea commit fcb871c

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/executor/network.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ async fn dhcpv4_run() {
138138
}
139139

140140
#[cfg(feature = "dns")]
141-
if dns_servers.len() > 0 {
141+
if !dns_servers.is_empty() {
142142
let dns_socket = dns::Socket::new(dns_servers.as_slice(), vec![]);
143143
nic.dns_handle = Some(nic.sockets.add(dns_socket));
144144
}

src/syscalls/socket.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,17 +365,15 @@ pub unsafe extern "C" fn sys_getaddrbyname(
365365
use crate::executor::block_on;
366366
use crate::executor::network::get_query_result;
367367

368-
if len != size_of::<in_addr>().try_into().unwrap()
369-
&& len != size_of::<in6_addr>().try_into().unwrap()
370-
{
368+
if len != size_of::<in_addr>() && len != size_of::<in6_addr>() {
371369
return -EINVAL;
372370
}
373371

374372
if inaddr.is_null() {
375373
return -EINVAL;
376374
}
377375

378-
let query_type = if len == size_of::<in6_addr>().try_into().unwrap() {
376+
let query_type = if len == size_of::<in6_addr>() {
379377
DnsQueryType::Aaaa
380378
} else {
381379
DnsQueryType::A

xtask/src/clippy.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ impl Clippy {
1717

1818
let triple = arch.triple();
1919
cmd!(sh, "cargo clippy --target={triple}").run()?;
20+
cmd!(sh, "cargo clippy --target={triple}")
21+
.arg("--features=acpi,dns,fsgsbase,pci,shell,smp,vga")
22+
.run()?;
2023
cmd!(sh, "cargo clippy --target={triple}")
2124
.arg("--no-default-features")
2225
.run()?;

0 commit comments

Comments
 (0)