Skip to content

Commit

Permalink
Cargo clippy fixes applied
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszklak committed Dec 10, 2024
1 parent b8e919e commit 26bf279
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
6 changes: 2 additions & 4 deletions crates/proto/src/rr/dnssec/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -745,15 +745,13 @@ mod tests {
#[allow(deprecated)]
#[allow(clippy::unreadable_literal)]
fn test_calculate_key_tag() {
let test_vectors = vec![
(vec![33, 3, 21, 11, 3, 1, 1, 1], 9739),
let test_vectors = [(vec![33, 3, 21, 11, 3, 1, 1, 1], 9739),
(
vec![
0xc2fedb69, 0x10001, 0x6ebb9209, 0xf743, 0xc9e3, 0xd07f, 0x6275, 0x1095,
],
42354,
),
];
)];

for &(ref input_data, exp_result) in test_vectors.iter() {
let rsa = get_rsa_from_vec(input_data).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions crates/proto/src/rr/rr_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ impl RecordSet {
RecordType::SOA => {
assert!(self.records.len() <= 1);

if let Some(soa_record) = self.records.get(0) {
if let Some(soa_record) = self.records.first() {
match soa_record.data() {
Some(RData::SOA(ref existing_soa)) => {
if let Some(RData::SOA(ref new_soa)) = record.data() {
Expand Down Expand Up @@ -866,7 +866,7 @@ mod test {

#[test]
#[cfg(feature = "dnssec")] // This tests RFC 6975, a DNSSEC-specific feature.
#[allow(clippy::blocks_in_if_conditions)]
#[allow(clippy::blocks_in_conditions)]
fn test_get_filter() {
use crate::rr::dnssec::rdata::DNSSECRData;
use crate::rr::dnssec::rdata::RRSIG;
Expand Down
4 changes: 2 additions & 2 deletions crates/proto/src/xfer/dnssec_dns_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ fn test_preserve() {
/// Invalid RRSIGs will be ignored. RRSIGs will only be validated against DNSKEYs which can
/// be validated through a chain back to the `trust_anchor`. As long as one RRSIG is valid,
/// then the RRSET will be valid.
#[allow(clippy::blocks_in_if_conditions)]
#[allow(clippy::blocks_in_conditions)]
async fn verify_default_rrset<H, E>(
handle: &DnssecDnsHandle<H>,
rrset: Rrset,
Expand Down Expand Up @@ -860,7 +860,7 @@ fn verify_rrset_with_dnskey(_: &DNSKEY, _: &RRSIG, _: &Rrset) -> ProtoResult<()>
/// corresponding RRSIG RR, a validator MUST ignore the settings of the
/// NSEC and RRSIG bits in an NSEC RR.
/// ```
#[allow(clippy::blocks_in_if_conditions)]
#[allow(clippy::blocks_in_conditions)]
#[doc(hidden)]
pub fn verify_nsec(query: &Query, soa_name: &Name, nsecs: &[&Record]) -> bool {
// TODO: consider converting this to Result, and giving explicit reason for the failure
Expand Down
8 changes: 4 additions & 4 deletions crates/resolver/src/dns_lru.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ mod tests {
Record::from_rdata(name.clone(), 1, RData::A(A::new(127, 0, 0, 1))),
1,
)];
let ips = vec![RData::A(A::new(127, 0, 0, 1))];
let ips = [RData::A(A::new(127, 0, 0, 1))];

// configure the cache with a minimum TTL of 2 seconds.
let ttls = TtlConfig {
Expand Down Expand Up @@ -500,7 +500,7 @@ mod tests {
Record::from_rdata(name.clone(), 62, RData::A(A::new(127, 0, 0, 1))),
62,
)];
let ips = vec![RData::A(A::new(127, 0, 0, 1))];
let ips = [RData::A(A::new(127, 0, 0, 1))];

// configure the cache with a maximum TTL of 60 seconds.
let ttls = TtlConfig {
Expand Down Expand Up @@ -589,7 +589,7 @@ mod tests {
Record::from_rdata(name, 1, RData::A(A::new(127, 0, 0, 1))),
1,
)];
let ips = vec![RData::A(A::new(127, 0, 0, 1))];
let ips = [RData::A(A::new(127, 0, 0, 1))];
let lru = DnsLru::new(1, TtlConfig::default());

let rc_ips = lru.insert(query.clone(), ips_ttl, now);
Expand All @@ -609,7 +609,7 @@ mod tests {
Record::from_rdata(name, 10, RData::A(A::new(127, 0, 0, 1))),
10,
)];
let ips = vec![RData::A(A::new(127, 0, 0, 1))];
let ips = [RData::A(A::new(127, 0, 0, 1))];
let lru = DnsLru::new(1, TtlConfig::default());

let rc_ips = lru.insert(query.clone(), ips_ttl, now);
Expand Down
2 changes: 1 addition & 1 deletion crates/server/src/authority/message_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ impl Queries {
length: self.queries.len(),
// We don't generally support more than one query, but this will at least give us one
// cache entry.
first_query: self.queries.get(0),
first_query: self.queries.first(),
cached_serialized: self.original.as_ref(),
}
}
Expand Down

0 comments on commit 26bf279

Please sign in to comment.