This commit is contained in:
daxpedda 2023-08-30 22:30:22 +02:00 committed by Benjamin Fry
parent 262c1eb2b0
commit 8e38497142
7 changed files with 24 additions and 22 deletions

View File

@ -425,8 +425,11 @@ impl<S: DnsUdpSocket + QuicLocalAddr + 'static> AsyncUdpSocket for QuinnAsyncUdp
// logics from quinn-udp::fallback.rs
let io = &self.io;
let Some(buf) = bufs.get_mut(0)else {
return Poll::Ready(Err(std::io::Error::new(std::io::ErrorKind::InvalidInput,"no buf")));
let Some(buf) = bufs.get_mut(0) else {
return Poll::Ready(Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
"no buf",
)));
};
match io.poll_recv_from(cx, buf.as_mut()) {
Poll::Ready(res) => match res {

View File

@ -514,7 +514,7 @@ impl IntoIterator for RecordSet {
type IntoIter = Chain<vec::IntoIter<Record>, vec::IntoIter<Record>>;
fn into_iter(self) -> Self::IntoIter {
self.records.into_iter().chain(self.rrsigs.into_iter())
self.records.into_iter().chain(self.rrsigs)
}
}

View File

@ -140,7 +140,7 @@ mod tests {
#[test]
fn test_a() {
let tokens = vec!["192.168.0.1"];
let tokens = ["192.168.0.1"];
let name = Name::from_str("example.com.").unwrap();
let record =
RData::parse(RecordType::A, tokens.iter().map(AsRef::as_ref), Some(&name)).unwrap();
@ -158,7 +158,7 @@ mod tests {
#[test]
fn test_aaaa() {
let tokens = vec!["::1"];
let tokens = ["::1"];
let name = Name::from_str("example.com.").unwrap();
let record = RData::parse(
RecordType::AAAA,
@ -191,7 +191,7 @@ mod tests {
#[test]
fn test_csync() {
let tokens = vec!["123", "1", "A", "NS"];
let tokens = ["123", "1", "A", "NS"];
let name = Name::from_str("example.com.").unwrap();
let record = RData::parse(
RecordType::CSYNC,
@ -262,7 +262,7 @@ mod tests {
#[test]
fn test_any() {
let tokens = vec!["test"];
let tokens = ["test"];
let name = Name::from_str("example.com.").unwrap();
let result = RData::parse(
RecordType::ANY,
@ -287,7 +287,7 @@ mod tests {
RecordType::RRSIG,
];
let tokens = vec!["test"];
let tokens = ["test"];
let name = Name::from_str("example.com.").unwrap();

View File

@ -380,8 +380,8 @@ where
let records = answers
.into_iter()
// Chained records will generally exist in the additionals section
.chain(additionals.into_iter())
.chain(name_servers.into_iter())
.chain(additionals)
.chain(name_servers)
.filter_map(|r| {
// because this resolved potentially recursively, we want the min TTL from the chain
let ttl = cname_ttl.min(r.ttl());

View File

@ -1115,9 +1115,8 @@ impl Authority for InMemoryAuthority {
}
// prepend answer to additionals here (answer is the ANAME record)
let additionals = std::iter::once(answer)
.chain(additionals.into_iter())
.collect();
let additionals =
std::iter::once(answer).chain(additionals).collect();
// return the new answer
// because the searched set was an Arc, we need to arc too

View File

@ -13,7 +13,7 @@ use trust_dns_server::store::in_memory::InMemoryAuthority;
#[allow(clippy::cognitive_complexity)]
fn test_zone() {
let lexer = Lexer::new(
r###"
r#"
@ IN SOA venera action\.domains (
20 ; SERIAL
7200 ; REFRESH
@ -54,7 +54,7 @@ _443._tcp.www.example.com. IN TLSA (
7983a1d16e8a410e4561cb106618e971)
tech. 3600 in soa ns0.centralnic.net. hostmaster.centralnic.net. 271851 900 1800 6048000 3600
"###,
"#,
);
let records = Parser::new().parse(lexer, Some(Name::from_str("isi.edu").unwrap()));
@ -407,7 +407,7 @@ tech. 3600 in soa ns0.centralnic.net. hostmaster.centralnic.ne
#[allow(clippy::cognitive_complexity)]
fn test_bad_cname_at_soa() {
let lexer = Lexer::new(
r###"
r"
@ IN SOA venera action\.domains (
20 ; SERIAL
7200 ; REFRESH
@ -417,7 +417,7 @@ fn test_bad_cname_at_soa() {
CNAME a
a A 127.0.0.1
"###,
",
);
let records = Parser::new().parse(lexer, Some(Name::from_str("isi.edu").unwrap()));
@ -434,7 +434,7 @@ a A 127.0.0.1
#[test]
fn test_bad_cname_at_a() {
let lexer = Lexer::new(
r###"
r"
@ IN SOA venera action\.domains (
20 ; SERIAL
7200 ; REFRESH
@ -445,7 +445,7 @@ fn test_bad_cname_at_a() {
a CNAME b
a A 127.0.0.1
b A 127.0.0.2
"###,
",
);
let records = Parser::new().parse(lexer, Some(Name::from_str("isi.edu").unwrap()));
@ -462,7 +462,7 @@ b A 127.0.0.2
#[test]
fn test_aname_at_soa() {
let lexer = Lexer::new(
r###"
r"
@ IN SOA venera action\.domains (
20 ; SERIAL
7200 ; REFRESH
@ -472,7 +472,7 @@ fn test_aname_at_soa() {
ANAME a
a A 127.0.0.1
"###,
",
);
let records = Parser::new().parse(lexer, Some(Name::from_str("isi.edu").unwrap()));

View File

@ -576,7 +576,7 @@ fn test_user_provided_server_order() {
// secondary server should be used.
preferred_server_records
.into_iter()
.chain(secondary_server_records.into_iter())
.chain(secondary_server_records)
.for_each(|expected_record| {
let request = message(query.clone(), vec![], vec![], vec![]);
let future = pool.send(request).first_answer();