Skip to content

Commit

Permalink
fix clippy warnings 5/15/2021
Browse files Browse the repository at this point in the history
  • Loading branch information
bluejekyll committed May 15, 2021
1 parent 8ce976e commit 0fb6720
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
6 changes: 3 additions & 3 deletions bin/src/named.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,13 @@ impl<'a> From<ArgMatches<'a>> for Args {
flag_zonedir: matches.value_of(ZONEDIR_ARG).map(ToString::to_string),
flag_port: matches
.value_of(PORT_ARG)
.map(|s| u16::from_str_radix(s, 10).expect("bad port argument")),
.map(|s| s.parse::<u16>().expect("bad port argument")),
flag_tls_port: matches
.value_of(TLS_PORT_ARG)
.map(|s| u16::from_str_radix(s, 10).expect("bad tls-port argument")),
.map(|s| s.parse::<u16>().expect("bad tls-port argument")),
flag_https_port: matches
.value_of(HTTPS_PORT_ARG)
.map(|s| u16::from_str_radix(s, 10).expect("bad https-port argument")),
.map(|s| s.parse::<u16>().expect("bad https-port argument")),
}
}
}
Expand Down
21 changes: 17 additions & 4 deletions bin/tests/server_harness/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,22 +130,35 @@ where

if let Some(udp) = udp_regex.captures(&output) {
test_udp_port = Some(
u16::from_str_radix(udp.get(1).expect("udp missing port").as_str(), 10)
udp.get(1)
.expect("udp missing port")
.as_str()
.parse::<u16>()
.expect("could not parse udp port"),
);
} else if let Some(tcp) = tcp_regex.captures(&output) {
test_tcp_port = Some(
u16::from_str_radix(tcp.get(1).expect("tcp missing port").as_str(), 10)
tcp.get(1)
.expect("tcp missing port")
.as_str()
.parse::<u16>()
.expect("could not parse tcp port"),
);
} else if let Some(tls) = tls_regex.captures(&output) {
test_tls_port = Some(
u16::from_str_radix(tls.get(1).expect("tls missing port").as_str(), 10)
tls.get(1)
.expect("tls missing port")
.as_str()
.parse::<u16>()
.expect("could not parse tls port"),
);
} else if let Some(https) = https_regex.captures(&output) {
test_https_port = Some(
u16::from_str_radix(https.get(1).expect("https missing port").as_str(), 10)
https
.get(1)
.expect("https missing port")
.as_str()
.parse::<u16>()
.expect("could not parse https port"),
);
} else if output.contains("awaiting connections...") {
Expand Down
2 changes: 1 addition & 1 deletion crates/client/src/serialize/txt/rdata_parsers/caa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub(crate) fn parse<'i, I: Iterator<Item = &'i str>>(mut tokens: I) -> ParseResu

// parse the flags
let issuer_critical = {
let flags = u8::from_str_radix(flags_str, 10)?;
let flags = flags_str.parse::<u8>()?;
if flags & 0b0111_1111 != 0 {
warn!("unexpected flag values in caa (0 or 128): {}", flags);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/client/src/serialize/txt/rdata_parsers/tlsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::rr::rdata::tlsa::CertUsage;
use crate::rr::rdata::{sshfp, TLSA};

fn to_u8(data: &str) -> ParseResult<u8> {
u8::from_str_radix(data, 10).map_err(ParseError::from)
data.parse::<u8>().map_err(ParseError::from)
}

/// Parse the RData from a set of Tokens
Expand Down
6 changes: 1 addition & 5 deletions crates/resolver/src/dns_sd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,7 @@ impl ServiceInfo {
let key = split.next().map(String::from_utf8_lossy);
let value = split.next().map(String::from_utf8_lossy);

if let Some(key) = key {
Some((key, value))
} else {
None
}
key.map(|key| (key, value))
})
.collect()
}
Expand Down

0 comments on commit 0fb6720

Please sign in to comment.