remove non-macro-use extern crate imports

This commit is contained in:
Dirkjan Ochtman 2020-10-12 21:04:50 +02:00 committed by Benjamin Fry
parent 1c0688ce20
commit 94fa917c74
38 changed files with 6 additions and 249 deletions

View File

@ -1,12 +1,6 @@
#![feature(test)]
extern crate futures;
extern crate test;
extern crate tokio;
extern crate trust_dns_client;
extern crate trust_dns_proto;
extern crate trust_dns_server;
use std::env;
use std::fs::{DirBuilder, File};

View File

@ -25,21 +25,10 @@
#![warn(missing_docs, clippy::dbg_macro, clippy::unimplemented)]
#![recursion_limit = "128"]
extern crate chrono;
#[macro_use]
extern crate clap;
extern crate futures;
#[macro_use]
extern crate log;
#[cfg(feature = "dns-over-rustls")]
extern crate rustls;
extern crate tokio;
extern crate trust_dns_client;
#[cfg(feature = "dns-over-openssl")]
extern crate trust_dns_openssl;
#[cfg(feature = "dns-over-rustls")]
extern crate trust_dns_rustls;
extern crate trust_dns_server;
use std::net::{IpAddr, Ipv4Addr, SocketAddr, ToSocketAddrs};
use std::path::{Path, PathBuf};

View File

@ -8,17 +8,8 @@
#![cfg(not(windows))]
#![cfg(feature = "dns-over-https")]
extern crate chrono;
extern crate futures;
#[macro_use]
extern crate log;
extern crate native_tls;
extern crate rustls;
extern crate tokio;
extern crate trust_dns_client;
extern crate trust_dns_https;
extern crate trust_dns_proto;
extern crate trust_dns_server;
mod server_harness;
@ -39,7 +30,6 @@ use server_harness::{named_test_harness, query_a};
#[test]
fn test_example_https_toml_startup() {
// extern crate env_logger;
// env_logger::try_init().ok();
const ALPN_H2: &[u8] = b"h2";

View File

@ -11,16 +11,8 @@
// TODO: enable this test for rustls as well using below config
// #![cfg(feature = "dns-over-tls")]
extern crate chrono;
extern crate futures;
#[macro_use]
extern crate log;
extern crate native_tls;
extern crate tokio;
extern crate trust_dns_client;
extern crate trust_dns_native_tls;
extern crate trust_dns_proto;
extern crate trust_dns_server;
mod server_harness;

View File

@ -8,16 +8,8 @@
#![cfg(not(windows))]
#![cfg(feature = "dns-over-rustls")]
extern crate chrono;
extern crate futures;
#[macro_use]
extern crate log;
extern crate rustls;
extern crate tokio;
extern crate trust_dns_client;
extern crate trust_dns_proto;
extern crate trust_dns_rustls;
extern crate trust_dns_server;
mod server_harness;

View File

@ -1,12 +1,8 @@
#![cfg(feature = "dnssec")]
#![cfg(not(windows))]
extern crate futures;
#[macro_use]
extern crate log;
extern crate tokio;
extern crate trust_dns_client;
extern crate trust_dns_proto;
mod server_harness;

View File

@ -5,17 +5,8 @@
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.
extern crate chrono;
extern crate futures;
#[macro_use]
extern crate log;
extern crate tokio;
extern crate trust_dns_client;
extern crate trust_dns_proto;
extern crate trust_dns_server;
#[cfg(feature = "dns-over-openssl")]
extern crate trust_dns_openssl;
mod server_harness;

View File

@ -529,9 +529,6 @@ impl Future for HttpsClientResponse {
#[cfg(test)]
mod tests {
extern crate env_logger;
extern crate tokio;
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr};
use std::str::FromStr;

View File

@ -22,11 +22,6 @@
clippy::unimplemented
)]
extern crate native_tls;
extern crate tokio;
extern crate tokio_tls;
extern crate trust_dns_proto;
pub mod tls_client_stream;
pub mod tls_stream;

View File

@ -5,12 +5,6 @@
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.
extern crate openssl;
extern crate tokio;
extern crate tokio_openssl;
extern crate trust_dns_openssl;
extern crate trust_dns_proto;
use std::io::{Read, Write};
#[cfg(not(target_os = "linux"))]
use std::net::Ipv6Addr;

View File

@ -2,10 +2,6 @@
#[macro_use]
extern crate lazy_static;
extern crate futures_util;
#[cfg(feature = "tokio-runtime")]
extern crate tokio;
extern crate trust_dns_resolver;
use std::fmt::Display;
#[cfg(feature = "tokio-runtime")]

View File

@ -1111,12 +1111,9 @@ pub mod testing {
#[cfg(test)]
#[cfg(feature = "tokio-runtime")]
mod tests {
extern crate env_logger;
extern crate tokio;
use proto::xfer::DnsRequest;
use tokio::runtime::Runtime;
use self::tokio::runtime::Runtime;
use crate::config::{ResolverConfig, ResolverOpts};
use crate::name_server::{TokioConnection, TokioConnectionProvider, TokioRuntime};

View File

@ -11,13 +11,14 @@ use std::convert::TryFrom;
use std::sync::Arc;
use std::time::{Duration, Instant};
use lru_cache::LruCache;
use proto::op::Query;
use proto::rr::Record;
use crate::config;
use crate::error::*;
use crate::lookup::Lookup;
use crate::lru_cache::LruCache;
/// Maximum TTL as defined in https://tools.ietf.org/html/rfc2181, 2147483647
/// Setting this to a value of 1 day, in seconds

View File

@ -1,6 +1,3 @@
extern crate rustls;
extern crate webpki_roots;
use std::net::SocketAddr;
use crate::name_server::RuntimeProvider;
@ -32,7 +29,6 @@ where
#[cfg(test)]
mod tests {
extern crate env_logger;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
use tokio::runtime::Runtime;

View File

@ -24,18 +24,11 @@
//! trust-dns-resolver = "*"
//! ```
//!
//! ## Extern the crate for usage in the library
//!
//! ```rust
//! extern crate trust_dns_resolver;
//! ```
//!
//! ## Using the Synchronous Resolver
//!
//! This uses the default configuration, which sets the [Google Public DNS](https://developers.google.com/speed/public-dns/) as the upstream resolvers. Please see their [privacy statement](https://developers.google.com/speed/public-dns/privacy) for important information about what they track, many ISP's track similar information in DNS.
//!
//! ```rust
//! # extern crate trust_dns_resolver;
//! # fn main() {
//! # #[cfg(feature = "tokio-runtime")]
//! # {
@ -68,7 +61,6 @@
//! On Unix systems, the `/etc/resolv.conf` can be used for configuration. Not all options specified in the host systems `resolv.conf` are applicable or compatible with this software. In addition there may be additional options supported which the host system does not. Example:
//!
//! ```rust,no_run
//! # extern crate trust_dns_resolver;
//! # fn main() {
//! # #[cfg(feature = "tokio-runtime")]
//! # {
@ -88,9 +80,6 @@
//! For more advanced asynchronous usage, the `AsyncResolver`] is integrated with Tokio. In fact, the [`AsyncResolver`] is used by the synchronous Resolver for all lookups.
//!
//! ```rust
//! # extern crate futures_util;
//! # extern crate tokio;
//! # extern crate trust_dns_resolver;
//! # fn main() {
//! # #[cfg(feature = "tokio-runtime")]
//! # {
@ -159,7 +148,6 @@
//! A default TLS configuration is available for Cloudflare's `1.1.1.1` DNS service (Quad9 as well):
//!
//! ```rust,no_run
//! # extern crate trust_dns_resolver;
//! # fn main() {
//! # #[cfg(feature = "tokio-runtime")]
//! # {
@ -195,31 +183,14 @@
#[cfg(feature = "dns-over-tls")]
#[macro_use]
extern crate cfg_if;
extern crate futures_util;
#[cfg(target_os = "windows")]
extern crate ipconfig;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
extern crate lru_cache;
#[cfg(feature = "unix-config")]
extern crate resolv_conf;
#[cfg(feature = "serde-config")]
#[macro_use]
extern crate serde;
extern crate smallvec;
#[cfg(feature = "tokio-runtime")]
extern crate tokio;
#[cfg(feature = "dns-over-https")]
extern crate trust_dns_https;
#[cfg(feature = "dns-over-native-tls")]
extern crate trust_dns_native_tls;
#[cfg(feature = "dns-over-openssl")]
extern crate trust_dns_openssl;
pub extern crate trust_dns_proto as proto;
#[cfg(feature = "dns-over-rustls")]
extern crate trust_dns_rustls;
mod async_resolver;
pub mod config;

View File

@ -265,8 +265,6 @@ where
#[cfg(test)]
#[cfg(feature = "tokio-runtime")]
mod tests {
extern crate env_logger;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::time::Duration;

View File

@ -433,8 +433,6 @@ impl Future for Local {
#[cfg(test)]
#[cfg(feature = "tokio-runtime")]
mod tests {
extern crate env_logger;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
use std::str::FromStr;

View File

@ -106,8 +106,6 @@ impl PartialOrd for NameServerStats {
#[cfg(test)]
mod tests {
extern crate env_logger;
use super::*;
fn is_send_sync<S: Sync + Send>() -> bool {

View File

@ -8,15 +8,12 @@
#![cfg(feature = "dns-over-rustls")]
#![allow(dead_code)]
extern crate rustls;
extern crate webpki_roots;
use std::net::SocketAddr;
use std::pin::Pin;
use std::sync::Arc;
use self::rustls::{ClientConfig, ProtocolVersion, RootCertStore};
use futures_util::future::Future;
use rustls::{ClientConfig, ProtocolVersion, RootCertStore};
use proto::error::ProtoError;
use proto::BufDnsStreamHandle;
@ -30,7 +27,7 @@ lazy_static! {
// using the mozilla default root store
pub(crate) static ref CLIENT_CONFIG: Arc<ClientConfig> = {
let mut root_store = RootCertStore::empty();
root_store.add_server_trust_anchors(&self::webpki_roots::TLS_SERVER_ROOTS);
root_store.add_server_trust_anchors(&webpki_roots::TLS_SERVER_ROOTS);
let versions = vec![ProtocolVersion::TLSv1_2];
let mut client_config = ClientConfig::new();

View File

@ -28,7 +28,6 @@ cfg_if! {
#[cfg(any(feature = "dns-over-native-tls", feature = "dns-over-rustls"))]
#[cfg(test)]
mod tests {
extern crate env_logger;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
use tokio::runtime::Runtime;

View File

@ -13,11 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
extern crate log;
extern crate trust_dns_client;
extern crate trust_dns_proto;
extern crate trust_dns_server;
use std::env;
use std::net::{Ipv4Addr, Ipv6Addr};
use std::path::{Path, PathBuf};

View File

@ -1,9 +1,6 @@
#![recursion_limit = "128"]
#![cfg(feature = "trust-dns-resolver")]
extern crate trust_dns_client;
extern crate trust_dns_server;
use std::net::Ipv4Addr;
use std::str::FromStr;

View File

@ -1,10 +1,5 @@
#![cfg(feature = "sqlite")]
extern crate rusqlite;
extern crate trust_dns_client;
extern crate trust_dns_proto;
extern crate trust_dns_server;
use std::net::*;
use std::str::FromStr;

View File

@ -1,6 +1,3 @@
extern crate trust_dns_client;
extern crate trust_dns_server;
use std::str::FromStr;
use trust_dns_client::rr::{LowerName, RecordType};

View File

@ -1,8 +1,5 @@
#![cfg(feature = "sqlite")]
extern crate trust_dns_client;
extern crate trust_dns_server;
use std::fs;
use std::path::PathBuf;
use std::str::FromStr;

View File

@ -1,7 +1,3 @@
extern crate tokio;
extern crate trust_dns_proto;
extern crate trust_dns_server;
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};

View File

@ -1,7 +1,3 @@
extern crate trust_dns_client;
extern crate trust_dns_proto;
extern crate trust_dns_server;
use std::net::{Ipv4Addr, Ipv6Addr};
use std::str::FromStr;

View File

@ -5,13 +5,6 @@
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.
extern crate chrono;
extern crate env_logger;
extern crate futures;
extern crate openssl;
extern crate trust_dns_client;
extern crate trust_dns_compatibility;
use std::env;
use std::fs::File;
use std::io::Read;

View File

@ -1,16 +1,6 @@
#![allow(dead_code)]
#![allow(clippy::dbg_macro)]
extern crate chrono;
extern crate futures;
extern crate openssl;
extern crate rustls;
extern crate tokio;
extern crate trust_dns_client;
extern crate trust_dns_proto;
extern crate trust_dns_rustls;
extern crate trust_dns_server;
use std::fmt;
use std::io;
use std::mem;

View File

@ -1,8 +1,3 @@
extern crate futures;
extern crate trust_dns_client;
extern crate trust_dns_integration;
extern crate trust_dns_server;
use std::net::*;
use std::str::FromStr;

View File

@ -1,20 +1,3 @@
extern crate chrono;
extern crate env_logger;
extern crate futures;
extern crate log;
extern crate openssl;
#[cfg(feature = "dns-over-https-rustls")]
extern crate rustls;
extern crate tokio;
extern crate trust_dns_client;
#[cfg(feature = "dns-over-https")]
extern crate trust_dns_https;
extern crate trust_dns_integration;
extern crate trust_dns_proto;
extern crate trust_dns_server;
#[cfg(feature = "dns-over-https-rustls")]
extern crate webpki_roots;
use std::net::*;
use std::str::FromStr;
use std::sync::{Arc, Mutex};
@ -141,7 +124,7 @@ fn test_query_https() {
// using the mozilla default root store
let mut root_store = RootCertStore::empty();
root_store.add_server_trust_anchors(&self::webpki_roots::TLS_SERVER_ROOTS);
root_store.add_server_trust_anchors(&webpki_roots::TLS_SERVER_ROOTS);
let versions = vec![ProtocolVersion::TLSv1_2];
let mut client_config = ClientConfig::new();

View File

@ -1,13 +1,3 @@
extern crate chrono;
extern crate env_logger;
extern crate futures;
extern crate openssl;
extern crate trust_dns_client;
extern crate trust_dns_integration;
extern crate trust_dns_proto;
extern crate trust_dns_rustls;
extern crate trust_dns_server;
use std::net::*;
use std::pin::Pin;
#[cfg(feature = "dnssec")]
@ -162,7 +152,6 @@ fn test_secure_query_example<CC>(client: SyncDnssecClient<CC>)
where
CC: ClientConnection,
{
// extern crate env_logger;
// env_logger::try_init().ok();
let name = Name::from_str("www.example.com").unwrap();

View File

@ -1,12 +1,5 @@
#![cfg(feature = "dnssec")]
extern crate futures;
extern crate tokio;
extern crate trust_dns_client;
extern crate trust_dns_integration;
extern crate trust_dns_proto;
extern crate trust_dns_server;
use std::net::*;
use std::str::FromStr;
use std::sync::{Arc, Mutex};

View File

@ -1,10 +1,3 @@
extern crate futures;
extern crate tokio;
extern crate trust_dns_integration;
extern crate trust_dns_proto;
extern crate trust_dns_resolver;
extern crate trust_dns_server;
use std::net::*;
use std::str::FromStr;
use std::sync::{Arc, Mutex};

View File

@ -1,16 +1,7 @@
#![cfg(feature = "mdns")]
extern crate chrono;
extern crate futures;
#[macro_use]
extern crate lazy_static;
extern crate log;
extern crate openssl;
extern crate tokio;
extern crate trust_dns_client;
extern crate trust_dns_integration;
extern crate trust_dns_proto;
extern crate trust_dns_server;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
use std::sync::atomic::{AtomicBool, Ordering};

View File

@ -1,10 +1,3 @@
extern crate futures;
extern crate tokio;
extern crate trust_dns_client;
extern crate trust_dns_integration;
extern crate trust_dns_proto;
extern crate trust_dns_resolver;
use std::net::*;
use std::pin::Pin;
use std::str::FromStr;

View File

@ -1,14 +1,3 @@
extern crate futures;
extern crate openssl;
extern crate rustls;
extern crate tokio;
extern crate trust_dns_client;
extern crate trust_dns_integration;
extern crate trust_dns_openssl;
extern crate trust_dns_proto;
extern crate trust_dns_rustls;
extern crate trust_dns_server;
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};
use std::str::FromStr;
use std::sync::atomic::{AtomicBool, Ordering};

View File

@ -1,11 +1,5 @@
#![cfg(feature = "sqlite")]
extern crate futures;
extern crate rusqlite;
extern crate trust_dns_client;
extern crate trust_dns_integration;
extern crate trust_dns_server;
use std::net::*;
use std::str::FromStr;