Skip to content

Commit

Permalink
proto: fix cargo destructure
Browse files Browse the repository at this point in the history
  • Loading branch information
leshow committed Mar 7, 2021
1 parent fede858 commit 64bd299
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 10 deletions.
6 changes: 3 additions & 3 deletions crates/client/src/error/dnssec_error.rs
Expand Up @@ -161,7 +161,7 @@ impl From<SslErrorStack> for Error {
pub mod not_openssl {
use std;

#[derive(Debug)]
#[derive(Debug, Clone, Copy)]
pub struct SslErrorStack;

impl std::fmt::Display for SslErrorStack {
Expand All @@ -181,10 +181,10 @@ pub mod not_openssl {
pub mod not_ring {
use std;

#[derive(Debug)]
#[derive(Debug, Clone, Copy)]
pub struct KeyRejected;

#[derive(Debug)]
#[derive(Debug, Clone, Copy)]
pub struct Unspecified;

impl std::fmt::Display for KeyRejected {
Expand Down
2 changes: 1 addition & 1 deletion crates/proto/src/error.rs
Expand Up @@ -354,7 +354,7 @@ pub mod not_ring {
use std;

/// The Unspecified error replacement
#[derive(Debug)]
#[derive(Debug, Copy, Clone)]
pub struct Unspecified;

impl std::fmt::Display for Unspecified {
Expand Down
8 changes: 8 additions & 0 deletions crates/proto/src/op/query.rs
Expand Up @@ -183,12 +183,20 @@ pub struct QueryParts {

impl From<Query> for QueryParts {
fn from(q: Query) -> Self {
#[cfg(feature = "mdns")]
let Query {
name,
query_type,
query_class,
mdns_unicast_response,
} = q;
#[cfg(not(feature = "mdns"))]
let Query {
name,
query_type,
query_class,
} = q;

Self {
name,
query_type,
Expand Down
11 changes: 11 additions & 0 deletions crates/proto/src/rr/resource.rs
Expand Up @@ -291,6 +291,7 @@ pub struct RecordParts {

impl From<Record> for RecordParts {
fn from(record: Record) -> Self {
#[cfg(feature = "mdns")]
let Record {
name_labels,
rr_type,
Expand All @@ -299,6 +300,16 @@ impl From<Record> for RecordParts {
rdata,
mdns_cache_flush,
} = record;

#[cfg(not(feature = "mdns"))]
let Record {
name_labels,
rr_type,
dns_class,
ttl,
rdata,
} = record;

RecordParts {
name_labels,
rr_type,
Expand Down
2 changes: 1 addition & 1 deletion crates/resolver/src/caching_client.rs
Expand Up @@ -177,7 +177,7 @@ where

let response_message = client
.client
.lookup(query.clone(), options.clone())
.lookup(query.clone(), options)
.await
.map_err(E::into);

Expand Down
4 changes: 2 additions & 2 deletions crates/resolver/src/lookup.rs
Expand Up @@ -245,7 +245,7 @@ where

let query: Pin<Box<dyn Future<Output = Result<Lookup, ResolveError>> + Send>> = match name {
Ok(name) => client_cache
.lookup(Query::query(name, record_type), options.clone())
.lookup(Query::query(name, record_type), options)
.boxed(),
Err(err) => future::err(err).boxed(),
};
Expand Down Expand Up @@ -287,7 +287,7 @@ where
if should_retry {
if let Some(name) = self.names.pop() {
let record_type = self.record_type;
let options = self.options.clone();
let options = self.options;

// If there's another name left to try, build a new query
// for that next name and continue looping.
Expand Down
6 changes: 3 additions & 3 deletions crates/resolver/src/lookup_ip.rs
Expand Up @@ -166,7 +166,7 @@ where
name,
self.strategy,
self.client_cache.clone(),
self.options.clone(),
self.options,
self.hosts.clone(),
)
.boxed();
Expand Down Expand Up @@ -315,7 +315,7 @@ where
hosts_lookup(
Query::query(name.clone(), RecordType::A),
client.clone(),
options.clone(),
options,
hosts.clone(),
)
.boxed(),
Expand Down Expand Up @@ -414,7 +414,7 @@ where
let res = hosts_lookup(
Query::query(name.clone(), first_type),
client,
options.clone(),
options,
hosts.clone(),
)
.await;
Expand Down

0 comments on commit 64bd299

Please sign in to comment.