From ac5cf90cb7f092f804c78e37244ffeca525dfc23 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 9 Jan 2025 21:43:15 +0100 Subject: [PATCH] Apply suggestions from clippy 1.84 --- crates/proto/src/dnssec/dnssec_dns_handle/mod.rs | 4 ++-- crates/proto/src/rr/domain/name.rs | 2 +- crates/proto/src/xfer/dns_response.rs | 2 +- crates/server/src/authority/catalog.rs | 2 +- crates/server/src/server/server_future.rs | 2 +- crates/server/src/store/in_memory/authority.rs | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/proto/src/dnssec/dnssec_dns_handle/mod.rs b/crates/proto/src/dnssec/dnssec_dns_handle/mod.rs index cbafa53f7b..88c7726a5e 100644 --- a/crates/proto/src/dnssec/dnssec_dns_handle/mod.rs +++ b/crates/proto/src/dnssec/dnssec_dns_handle/mod.rs @@ -1143,7 +1143,7 @@ pub fn verify_nsec(query: &Query, soa_name: &Name, nsecs: &[&Record]) -> Proof { .data() .as_dnssec() .and_then(DNSSECRData::as_nsec) - .map_or(false, |rdata| { + .is_some_and(|rdata| { // this should not be in the covered list !rdata.type_bit_maps().contains(&query.query_type()) }) @@ -1161,7 +1161,7 @@ pub fn verify_nsec(query: &Query, soa_name: &Name, nsecs: &[&Record]) -> Proof { nsec.data() .as_dnssec() .and_then(DNSSECRData::as_nsec) - .map_or(false, |rdata| { + .is_some_and(|rdata| { // the query name is less than the next name // or this record wraps the end, i.e. is the last record name < rdata.next_domain_name() || rdata.next_domain_name() < nsec.name() diff --git a/crates/proto/src/rr/domain/name.rs b/crates/proto/src/rr/domain/name.rs index 18ab83ef92..582d5687e9 100644 --- a/crates/proto/src/rr/domain/name.rs +++ b/crates/proto/src/rr/domain/name.rs @@ -965,7 +965,7 @@ impl Name { /// assert!(!name.is_wildcard()); /// ``` pub fn is_wildcard(&self) -> bool { - self.iter().next().map_or(false, |l| l == b"*") + self.iter().next().is_some_and(|l| l == b"*") } /// Converts a name to a wildcard, by replacing the first label with `*` diff --git a/crates/proto/src/xfer/dns_response.rs b/crates/proto/src/xfer/dns_response.rs index fc44fe0a28..17388a7a24 100644 --- a/crates/proto/src/xfer/dns_response.rs +++ b/crates/proto/src/xfer/dns_response.rs @@ -263,7 +263,7 @@ impl DnsResponse { pub fn negative_type(&self) -> Option { let response_code = self.response_code(); let ttl_from_soa = self.negative_ttl(); - let has_soa = ttl_from_soa.map_or(false, |_| true); + let has_soa = ttl_from_soa.is_some(); let has_ns_records = self.name_servers().iter().any(|r| r.record_type().is_ns()); let has_cname = self.answers().iter().any(|r| r.record_type().is_cname()); let has_non_cname = self.answers().iter().any(|r| !r.record_type().is_cname()); diff --git a/crates/server/src/authority/catalog.rs b/crates/server/src/authority/catalog.rs index 74dff96a66..ab800e7e49 100644 --- a/crates/server/src/authority/catalog.rs +++ b/crates/server/src/authority/catalog.rs @@ -389,7 +389,7 @@ impl Catalog { } } -async fn lookup<'a, R: ResponseHandler + Unpin>( +async fn lookup( request_info: RequestInfo<'_>, authorities: &[Arc], request: &Request, diff --git a/crates/server/src/server/server_future.rs b/crates/server/src/server/server_future.rs index 959752a5e2..eeee6ed094 100644 --- a/crates/server/src/server/server_future.rs +++ b/crates/server/src/server/server_future.rs @@ -911,7 +911,7 @@ pub(crate) async fn handle_request( let qflags = message.header().flags(); let qop_code = message.op_code(); let message_type = message.message_type(); - let is_dnssec = message.edns().map_or(false, |edns| edns.flags().dnssec_ok); + let is_dnssec = message.edns().is_some_and(|edns| edns.flags().dnssec_ok); let request = Request::new(message, src_addr, protocol); diff --git a/crates/server/src/store/in_memory/authority.rs b/crates/server/src/store/in_memory/authority.rs index 4d12e40ba6..2d78b2591a 100644 --- a/crates/server/src/store/in_memory/authority.rs +++ b/crates/server/src/store/in_memory/authority.rs @@ -1455,7 +1455,7 @@ impl Authority for InMemoryAuthority { .map(Record::data) .and_then(RData::as_dnssec) .and_then(DNSSECRData::as_nsec) - .map_or(false, |r| { + .is_some_and(|r| { // the search name is less than the next NSEC record *name < r.next_domain_name().into() || // this is the last record, and wraps to the beginning of the zone