localize clippy allowance

This commit is contained in:
Benjamin Fry 2019-01-20 10:26:30 -08:00
parent a146703be7
commit 7fcdc9aa58
43 changed files with 55 additions and 15 deletions

View File

@ -55,6 +55,7 @@ pub trait Client {
/// Return the inner Futures items
///
/// Consumes the connection and allows for future based operations afterward.
#[allow(clippy::type_complexity)]
fn new_future(
&self,
) -> (
@ -432,6 +433,7 @@ where
type SenderFuture = CC::SenderFuture;
type Handle = BasicClientHandle<CC::Response>;
#[allow(clippy::type_complexity)]
fn new_future(
&self,
) -> (
@ -461,6 +463,7 @@ where
/// # Arguments
///
/// * `client_connection` - the client_connection to use for all communication
#[allow(clippy::new_ret_no_self)]
pub fn new(conn: CC) -> SecureSyncClientBuilder<CC> {
SecureSyncClientBuilder {
conn,
@ -516,6 +519,7 @@ where
type SenderFuture = CC::SenderFuture;
type Handle = SecureClientHandle<BasicClientHandle<Self::Response>>;
#[allow(clippy::type_complexity)]
fn new_future(
&self,
) -> (

View File

@ -16,6 +16,7 @@
//! DNS Client associated classes for performing queries and other operations.
#[allow(clippy::module_inception)]
mod client;
mod client_connection;
pub(crate) mod client_future;

View File

@ -9,6 +9,7 @@ use std::sync::{Arc, Mutex};
use futures::{Async, Fuse, Future, IntoFuture, Poll};
#[allow(clippy::type_complexity)]
pub struct RcFuture<F: Future>
where
F: Future + Send,

View File

@ -36,6 +36,7 @@ impl HttpsClientConnection {
/// # Arguments
///
/// * `name_server` - address of the name server to use for queries
#[allow(clippy::new_ret_no_self)]
pub fn new() -> HttpsClientConnectionBuilder {
HttpsClientConnectionBuilder::new()
}

View File

@ -722,6 +722,7 @@ mod tests {
#[test]
#[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),
@ -773,6 +774,7 @@ MC0CAQACBQC+L6pNAgMBAAECBQCYj0ZNAgMA9CsCAwDHZwICeEUCAnE/AgMA3u0=
// TODO: these tests technically came from TBS in trust_dns_proto
#[cfg(feature = "openssl")]
#[allow(clippy::module_inception)]
#[cfg(test)]
mod tests {
extern crate openssl;

View File

@ -157,6 +157,7 @@ impl<'n> TrieKey for TrieNameRef<'n> {
pub struct UsageTrie(Trie<TrieName, &'static ZoneUsage>);
impl UsageTrie {
#[allow(clippy::cyclomatic_complexity)]
fn default() -> Self {
let mut trie: Trie<TrieName, &'static ZoneUsage> = Trie::new();

View File

@ -596,6 +596,7 @@ mod lex_test {
}
#[test]
#[allow(clippy::cyclomatic_complexity)]
fn soa() {
let mut lexer = Lexer::new(
"@ IN SOA VENERA Action\\.domains (

View File

@ -453,6 +453,7 @@ struct TlsConfig {
dns_name: Arc<String>,
}
#[allow(clippy::large_enum_variant)]
enum HttpsClientConnectState {
ConnectTcp {
name_server: SocketAddr,

View File

@ -24,6 +24,7 @@ use tokio::runtime::current_thread::Runtime;
use trust_dns_proto::xfer::SerialMessage;
#[allow(clippy::useless_attribute)]
#[allow(unused)]
use {TlsStream, TlsStreamBuilder};

View File

@ -22,6 +22,7 @@ pub use tokio_openssl::SslAcceptorExt;
/// Read the certificate from the specified path.
///
/// If the password is specified, then it will be used to decode the Certificate
#[allow(clippy::type_complexity)]
pub fn read_cert_pkcs12(
path: &Path,
password: Option<&str>,

View File

@ -50,6 +50,7 @@ impl MdnsClientStream {
///
/// a tuple of a Future Stream which will handle sending and receiving messsages, and a
/// handle which can be used to send messages into the stream.
#[allow(clippy::new_ret_no_self)]
pub fn new(
mdns_addr: SocketAddr,
mdns_query_type: MdnsQueryType,

View File

@ -716,6 +716,7 @@ impl<'e, I: Iterator<Item = &'e E>, E: 'e + BinEncodable> EmitAndCount for I {
}
/// Emits the different sections of a message properly
#[allow(clippy::too_many_arguments)]
pub fn emit_message_parts<Q, A, N, D>(
header: &Header,
queries: &mut Q,

View File

@ -212,6 +212,7 @@ impl SIG {
/// # Return value
///
/// The new SIG record data.
#[allow(clippy::too_many_arguments)]
pub fn new(
type_covered: RecordType,
algorithm: Algorithm,
@ -521,6 +522,7 @@ pub fn emit(encoder: &mut BinEncoder, sig: &SIG) -> ProtoResult<()> {
}
/// specifically for outputing the RData for an RRSIG, with signer_name in canonical form
#[allow(clippy::too_many_arguments)]
pub fn emit_pre_sig(
encoder: &mut BinEncoder,
type_covered: RecordType,

View File

@ -74,6 +74,7 @@ pub fn message_tbs<M: BinEncodable>(message: &M, pre_sig0: &SIG) -> ProtoResult<
/// # Returns
///
/// the binary hash of the specified RRSet and associated information
#[allow(clippy::too_many_arguments)]
pub fn rrset_tbs(
name: &Name,
dns_class: DNSClass,

View File

@ -9,6 +9,7 @@
//!
//! A label is stored internally as ascii, where all unicode characters are converted to punycode interenally.
#[allow(clippy::useless_attribute)]
#[allow(unused)]
#[allow(deprecated)]
use std::ascii::AsciiExt;

View File

@ -1200,6 +1200,7 @@ mod tests {
use super::*;
use serialize::binary::bin_tests::{test_emit_data_set, test_read_data_set};
#[allow(clippy::useless_attribute)]
#[allow(unused)]
use serialize::binary::*;

View File

@ -393,6 +393,7 @@ pub struct ZoneUsage {
impl ZoneUsage {
/// Constructs a new ZoneUsage with the associated values
#[allow(clippy::too_many_arguments)]
pub fn new(name: Name, user: UserUsage, app: AppUsage, resolver: ResolverUsage, cache: CacheUsage, auth: AuthUsage, op: OpUsage, registry: RegistryUsage) -> Self {
ZoneUsage {name, user, app, resolver, cache, auth, op, registry}
}

View File

@ -38,6 +38,7 @@ use serialize::binary::*;
use error::*;
/// Read the RData from the given Decoder
#[allow(clippy::many_single_char_names)]
pub fn read(decoder: &mut BinDecoder) -> ProtoResult<Ipv6Addr> {
let a: u16 = decoder.read_u16()?.unverified(/*valid as any u16*/);
let b: u16 = decoder.read_u16()?.unverified(/*valid as any u16*/);

View File

@ -475,7 +475,6 @@ impl RData {
let mut encoder: BinEncoder = BinEncoder::new(&mut buf);
self.emit(&mut encoder).unwrap_or_else(|_| {
warn!("could not encode RDATA: {:?}", self);
()
});
}
buf
@ -703,6 +702,7 @@ mod tests {
use rr::domain::Name;
use rr::rdata::{MX, SOA, SRV, TXT};
use serialize::binary::bin_tests::test_emit_data_set;
#[allow(clippy::useless_attribute)]
#[allow(unused)]
use serialize::binary::*;

View File

@ -422,6 +422,7 @@ mod tests {
use rr::record_data::RData;
use rr::record_type::RecordType;
use rr::Name;
#[allow(clippy::useless_attribute)]
#[allow(unused)]
use serialize::binary::*;

View File

@ -581,6 +581,7 @@ mod test {
}
#[test]
#[allow(clippy::unreadable_literal)]
fn test_insert_soa() {
let name = Name::from_str("example.com.").unwrap();
let record_type = RecordType::SOA;
@ -720,6 +721,7 @@ mod test {
}
#[test]
#[allow(clippy::unreadable_literal)]
fn test_remove_soa() {
let name = Name::from_str("www.example.com.").unwrap();
let record_type = RecordType::SOA;
@ -783,6 +785,7 @@ mod test {
#[test]
#[cfg(feature = "dnssec")] // This tests RFC 6975, a DNSSEC-specific feature.
#[allow(clippy::block_in_if_condition_stmt)]
fn test_get_filter() {
use rr::dnssec::rdata::SIG;
use rr::dnssec::rdata::{DNSSECRData, DNSSECRecordType};

View File

@ -91,6 +91,7 @@ fn emit_i32() {
test_emit_data_set(get_i32_data(), |ref mut e, d| e.emit_i32(d));
}
#[allow(clippy::unreadable_literal)]
fn get_u32_data() -> Vec<(u32, Vec<u8>)> {
vec![
(0, vec![0x00, 0x00, 0x00, 0x00]),

View File

@ -35,6 +35,7 @@ impl TcpClientStream<TokioTcpStream> {
/// # Arguments
///
/// * `name_server` - the IP and Port of the DNS server to connect to
#[allow(clippy::new_ret_no_self)]
pub fn new(name_server: SocketAddr) -> (TcpClientConnect, Box<DnsStreamHandle + Send>) {
Self::with_timeout(name_server, Duration::from_secs(5))
}

View File

@ -45,6 +45,7 @@ impl UdpClientStream<NoopMessageFinalizer> {
///
/// a tuple of a Future Stream which will handle sending and receiving messsages, and a
/// handle which can be used to send messages into the stream.
#[allow(clippy::new_ret_no_self)]
pub fn new(name_server: SocketAddr) -> UdpClientConnect<NoopMessageFinalizer> {
Self::with_timeout(name_server, Duration::from_secs(5))
}

View File

@ -82,6 +82,7 @@ where
type Item = ();
type Error = ProtoError;
#[allow(clippy::unused_unit)]
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
// this will not accept incoming data while there is data to send
// makes this self throttling.

View File

@ -138,6 +138,7 @@ where
/// (see TcpClientStream or UdpClientStream)
/// * `stream_handle` - The handle for the `stream` on which bytes can be sent/received.
/// * `signer` - An optional signer for requests, needed for Updates with Sig0, otherwise not needed
#[allow(clippy::new_ret_no_self)]
pub fn new<F>(
stream: F,
stream_handle: Box<DnsStreamHandle>,

View File

@ -600,6 +600,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::block_in_if_condition_stmt)]
fn verify_default_rrset<H>(
handle: &SecureDnsHandle<H>,
rrset: Rrset,
@ -806,6 +807,7 @@ fn verify_rrset_with_dnskey(_: &DNSKEY, _: &SIG, _: &Rrset) -> ProtoResult<()> {
/// corresponding RRSIG RR, a validator MUST ignore the settings of the
/// NSEC and RRSIG bits in an NSEC RR.
/// ```
#[allow(clippy::block_in_if_condition_stmt)]
fn verify_nsec(query: &Query, nsecs: &[&Record]) -> bool {
// first look for a record with the same name
// if they are, then the query_type should not exist in the NSEC record.

View File

@ -90,6 +90,7 @@ type BgSend<F, G> = futures::AndThen<
>;
/// Used by `AsyncResolver` for communicating with the background resolver task.
#[allow(clippy::large_enum_variant)]
enum Request {
/// Requests a lookup of the specified `RecordType`.
Lookup {

View File

@ -11,6 +11,7 @@ use proto::error::ProtoError;
use proto::xfer::{BufDnsRequestStreamHandle, DnsExchange};
use trust_dns_https::{HttpsClientStream, HttpsClientStreamBuilder, HttpsSerialResponse};
#[allow(clippy::type_complexity)]
pub(crate) fn new_https_stream(
socket_addr: SocketAddr,
dns_name: String,

View File

@ -8,6 +8,7 @@
mod connection_provider;
mod name_server_pool;
mod name_server_stats;
#[allow(clippy::module_inception)]
mod name_server;
use self::name_server_stats::{NameServerStats, NameServerState};

View File

@ -180,6 +180,7 @@ where
}
}
#[allow(clippy::large_enum_variant)]
enum TrySend<C: DnsHandle + 'static, P: ConnectionProvider<ConnHandle = C> + 'static> {
Lock {
opts: ResolverOpts,

View File

@ -21,6 +21,7 @@ use trust_dns::rr::LowerName;
/// * `'r` - the recordset lifetime, subset of 'c
/// * `'q` - the queries lifetime
#[derive(Debug)]
#[allow(clippy::large_enum_variant)]
pub enum AuthLookup {
/// There is no matching name for the query
NxDomain,
@ -116,6 +117,7 @@ impl<'a> IntoIterator for &'a AuthLookup {
}
/// An iterator over an Authority Lookup
#[allow(clippy::large_enum_variant)]
pub enum AuthLookupIter<'r> {
/// The empty set
Empty,

View File

@ -35,6 +35,7 @@ pub enum ZoneType {
}
mod auth_lookup;
#[allow(clippy::module_inception)]
mod authority;
mod catalog;
pub(crate) mod message_request;

View File

@ -523,6 +523,7 @@ impl SqliteAuthority {
/// ```
///
#[cfg(feature = "dnssec")]
#[allow(clippy::block_in_if_condition_stmt)]
pub fn authorize(&self, update_message: &MessageRequest) -> UpdateResult<()> {
use proto::rr::dnssec::Verifier;
use trust_dns::rr::rdata::{DNSSECRData, DNSSECRecordType};
@ -623,6 +624,7 @@ impl SqliteAuthority {
/// MAILB, or any other QUERY metatype besides ANY, or any unrecognized
/// type, else signal FORMERR to the requestor.
/// ```
#[allow(clippy::unused_unit)]
pub fn pre_scan(&self, records: &[Record]) -> UpdateResult<()> {
// 3.4.1.3 - Pseudocode For Update Section Prescan
//

View File

@ -22,6 +22,7 @@ pub fn test_a_lookup<A: Authority>(authority: A) {
}
}
#[allow(clippy::unreadable_literal)]
pub fn test_soa<A: Authority>(authority: A) {
let lookup = authority.soa();

View File

@ -24,6 +24,7 @@ pub fn test_a_lookup<A: Authority>(authority: A, keys: &[DNSKEY]) {
verify(&a_records, &rrsig_records, keys);
}
#[allow(clippy::unreadable_literal)]
pub fn test_soa<A: Authority>(authority: A, keys: &[DNSKEY]) {
let lookup = authority.soa_secure(true, SupportedAlgorithms::new());

View File

@ -14,6 +14,7 @@ use trust_dns_server::authority::*;
use trust_dns_server::store::sqlite::SqliteAuthority;
#[test]
#[allow(clippy::cyclomatic_complexity)]
fn test_string() {
let lexer = Lexer::new(
"@ IN SOA venera action\\.domains (

View File

@ -62,6 +62,7 @@ fn trust_anchor(public_key_path: &Path, format: KeyFormat, algorithm: Algorithm)
trust_anchor
}
#[allow(clippy::type_complexity)]
fn standard_conn(
port: u16,
) -> (

View File

@ -16,20 +16,7 @@ cargo clean -p trust-dns-compatibility
cargo clean -p trust-dns-integration
TARGETS_OPTS="--all --lib --examples --tests --bins"
CLIPPY_OPTS="-D warnings\
-A clippy::block_in_if_condition_stmt\
-A clippy::cyclomatic_complexity\
-A clippy::large_enum_variant\
-A clippy::many_single_char_names\
-A clippy::module-inception\
-A clippy::needless_pass_by_value\
-A clippy::new_ret_no_self\
-A clippy::too_many_arguments\
-A clippy::type_complexity\
-A clippy::unreadable_literal\
-A clippy::useless_attribute\
-A clippy::unused_unit\
"
CLIPPY_OPTS="-D warnings"
cargo clippy ${TARGETS_OPTS:?} -- ${CLIPPY_OPTS:?}
cargo clippy ${TARGETS_OPTS:?} --all-features -- ${CLIPPY_OPTS:?}

View File

@ -6,6 +6,7 @@ use trust_dns_server::authority::ZoneType;
use trust_dns_server::store::sqlite::SqliteAuthority;
#[allow(unused)]
#[allow(clippy::unreadable_literal)]
pub fn create_example() -> SqliteAuthority {
use std::net::*;
use trust_dns::rr::rdata::*;

View File

@ -16,6 +16,7 @@ use trust_dns_server::store::sqlite::SqliteAuthority;
use trust_dns_integration::authority::create_example;
use trust_dns_integration::*;
#[allow(clippy::unreadable_literal)]
pub fn create_test() -> SqliteAuthority {
let origin: Name = Name::parse("test.com.", None).unwrap();
let mut records: SqliteAuthority = SqliteAuthority::new(
@ -198,6 +199,7 @@ fn test_catalog_lookup() {
}
#[test]
#[allow(clippy::unreadable_literal)]
fn test_catalog_nx_soa() {
let example = create_example();
let origin = example.origin().clone();
@ -244,6 +246,7 @@ fn test_catalog_nx_soa() {
}
#[test]
#[allow(clippy::unreadable_literal)]
fn test_axfr() {
let mut test = create_test();
test.set_allow_axfr(true);

View File

@ -218,6 +218,7 @@ fn test_notify() {
/// create a client with a sig0 section
#[cfg(feature = "dnssec")]
#[allow(clippy::type_complexity)]
fn create_sig0_ready_client(
_io_loop: &mut Runtime,
) -> (

View File

@ -970,6 +970,7 @@ fn test_journal() {
}
#[test]
#[allow(clippy::block_in_if_condition_stmt)]
fn test_recovery() {
// test that this message can be inserted
let conn = Connection::open_in_memory().expect("could not create in memory DB");