Skip to content

Commit

Permalink
Merge pull request #1499 from hermit-os/clippy-dns
Browse files Browse the repository at this point in the history
fix: run clippy on `feature = "dns"`
  • Loading branch information
mkroening authored Dec 4, 2024
2 parents e5ea9ac + 22476ea commit fcb871c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/executor/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async fn dhcpv4_run() {
}

#[cfg(feature = "dns")]
if dns_servers.len() > 0 {
if !dns_servers.is_empty() {
let dns_socket = dns::Socket::new(dns_servers.as_slice(), vec![]);
nic.dns_handle = Some(nic.sockets.add(dns_socket));
}
Expand Down
6 changes: 2 additions & 4 deletions src/syscalls/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,17 +365,15 @@ pub unsafe extern "C" fn sys_getaddrbyname(
use crate::executor::block_on;
use crate::executor::network::get_query_result;

if len != size_of::<in_addr>().try_into().unwrap()
&& len != size_of::<in6_addr>().try_into().unwrap()
{
if len != size_of::<in_addr>() && len != size_of::<in6_addr>() {
return -EINVAL;
}

if inaddr.is_null() {
return -EINVAL;
}

let query_type = if len == size_of::<in6_addr>().try_into().unwrap() {
let query_type = if len == size_of::<in6_addr>() {
DnsQueryType::Aaaa
} else {
DnsQueryType::A
Expand Down
3 changes: 3 additions & 0 deletions xtask/src/clippy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ impl Clippy {

let triple = arch.triple();
cmd!(sh, "cargo clippy --target={triple}").run()?;
cmd!(sh, "cargo clippy --target={triple}")
.arg("--features=acpi,dns,fsgsbase,pci,shell,smp,vga")
.run()?;
cmd!(sh, "cargo clippy --target={triple}")
.arg("--no-default-features")
.run()?;
Expand Down

0 comments on commit fcb871c

Please sign in to comment.