Skip to content

Commit

Permalink
fixes for nightly clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
olix0r committed Feb 21, 2024
1 parent 5222fab commit 457f71b
Show file tree
Hide file tree
Showing 39 changed files with 28 additions and 75 deletions.
2 changes: 1 addition & 1 deletion linkerd/addr/src/addr_match.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::Addr;
use ipnet::IpNet;
use linkerd_dns_name::{Name, Suffix};
use std::{fmt, iter::FromIterator, net::IpAddr, sync::Arc};
use std::{fmt, net::IpAddr, sync::Arc};

#[derive(Clone, Debug, Default)]
pub struct AddrMatch {
Expand Down
2 changes: 1 addition & 1 deletion linkerd/app/admin/src/server/readiness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub struct Readiness(Weak<()>);

/// When all latches are dropped, the process is considered ready.
#[derive(Clone, Debug)]
pub struct Latch(Arc<()>);
pub struct Latch(#[allow(dead_code)] Arc<()>);

impl Readiness {
pub fn new() -> (Readiness, Latch) {
Expand Down
5 changes: 1 addition & 4 deletions linkerd/app/gateway/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ use linkerd_app_core::{
};
use linkerd_app_inbound as inbound;
use linkerd_app_outbound as outbound;
use std::{
cmp::{Eq, PartialEq},
fmt::Debug,
};
use std::fmt::Debug;
use tokio::sync::watch;

mod gateway;
Expand Down
2 changes: 1 addition & 1 deletion linkerd/app/inbound/src/direct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use linkerd_app_core::{
transport_header::{self, NewTransportHeaderServer, SessionProtocol, TransportHeader},
Conditional, Error, Infallible, NameAddr, Result,
};
use std::{convert::TryFrom, fmt::Debug};
use std::fmt::Debug;
use thiserror::Error;
use tracing::{debug_span, info_span};

Expand Down
3 changes: 0 additions & 3 deletions linkerd/app/integration/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ use super::*;
use linkerd_app_core::proxy::http::trace;
use parking_lot::Mutex;
use std::io;
use std::{convert::TryFrom, sync::Arc};
use tokio::net::TcpStream;
use tokio::sync::{mpsc, oneshot};
use tokio::task::JoinHandle;
use tokio_rustls::rustls::{self, ClientConfig};
use tracing::info_span;
use tracing::instrument::Instrument;

type ClientError = hyper::Error;
type Request = http::Request<hyper::Body>;
Expand Down
5 changes: 1 addition & 4 deletions linkerd/app/integration/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ pub use linkerd2_proxy_api::destination as pb;
use linkerd2_proxy_api::net;
use linkerd_app_core::proxy::http::trace;
use parking_lot::Mutex;
use std::collections::{HashMap, VecDeque};
use std::collections::VecDeque;
use std::net::IpAddr;
use std::ops::{Bound, RangeBounds};
use std::sync::Arc;
use tokio::sync::mpsc;
use tokio_stream::wrappers::UnboundedReceiverStream;
use tonic as grpc;
use tracing::instrument::Instrument;

pub fn new() -> Controller {
Controller::new()
Expand Down
3 changes: 1 addition & 2 deletions linkerd/app/integration/src/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use std::{
collections::VecDeque,
fs, io,
path::{Path, PathBuf},
sync::Arc,
time::{Duration, SystemTime},
time::SystemTime,
};

use linkerd2_proxy_api::identity as pb;
Expand Down
5 changes: 2 additions & 3 deletions linkerd/app/integration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ mod tests;

pub use self::test_env::TestEnv;
pub use bytes::{Buf, BufMut, Bytes};
pub use futures::{future, FutureExt, TryFuture, TryFutureExt};

pub use futures::stream::{Stream, StreamExt};
pub use futures::{future, FutureExt, TryFuture, TryFutureExt};
pub use http::{HeaderMap, Request, Response, StatusCode};
pub use http_body::Body as HttpBody;
pub use linkerd_app as app;
Expand All @@ -43,7 +42,7 @@ use std::task::{Context, Poll};
pub use std::time::Duration;
pub use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, ReadBuf};
use tokio::net::TcpListener;
pub use tokio::sync::oneshot;
pub use tokio::sync::{mpsc, oneshot};
pub use tonic as grpc;
pub use tower::Service;

Expand Down
1 change: 0 additions & 1 deletion linkerd/app/integration/src/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::collections::HashMap;
use std::fmt;
use std::string::ToString;

#[derive(Debug, Clone)]
pub struct MetricMatch {
Expand Down
3 changes: 1 addition & 2 deletions linkerd/app/integration/src/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use api::{inbound::inbound_server_policies_server, outbound::outbound_policies_s
use futures::stream;
use linkerd2_proxy_api as api;
use parking_lot::Mutex;
use std::{collections::VecDeque, sync::Arc, time::Duration};
use tokio::sync::mpsc;
use std::collections::VecDeque;
use tokio_stream::wrappers::UnboundedReceiverStream;
use tonic as grpc;

Expand Down
5 changes: 1 addition & 4 deletions linkerd/app/integration/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ use linkerd_app_core::{
transport::{listen, orig_dst, Keepalive, ListenAddr},
Result,
};
use std::{
collections::HashSet, fmt, future::Future, net::SocketAddr, pin::Pin, task::Poll, thread,
};
use std::{collections::HashSet, thread};
use tokio::net::TcpStream;
use tracing::instrument::Instrument;

pub fn new() -> Proxy {
Proxy::default()
Expand Down
9 changes: 1 addition & 8 deletions linkerd/app/integration/src/server.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
use super::*;
use futures::TryFuture;
use linkerd_app_core::proxy::http::trace;
use std::{
collections::HashMap,
future::Future,
io,
pin::Pin,
sync::atomic::{AtomicUsize, Ordering},
sync::Arc,
task::{Context, Poll},
};
use tokio::{net::TcpStream, sync::oneshot, task::JoinHandle};
use tokio::{net::TcpStream, task::JoinHandle};
use tokio_rustls::{rustls::ServerConfig, TlsAcceptor};
use tracing::instrument::Instrument;

pub fn new() -> Server {
http2()
Expand Down
5 changes: 0 additions & 5 deletions linkerd/app/integration/src/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@ use super::*;
use std::collections::VecDeque;
use std::io;
use std::net::TcpListener as StdTcpListener;
use std::pin::Pin;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpStream;
use tokio::sync::{mpsc, oneshot};
use tokio::task::JoinHandle;
use tracing::instrument::Instrument;

type TcpConnSender = mpsc::UnboundedSender<(
Option<Vec<u8>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use linkerd_app_core::{
svc, tls,
};
use std::{
future::Future,
pin::Pin,
task::{Context, Poll},
};
Expand Down
11 changes: 2 additions & 9 deletions linkerd/app/outbound/src/tcp/endpoint.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
use super::{tagged_transport::TaggedTransport, *};
use crate::{ConnectMeta, Outbound};
use linkerd_app_core::{
io,
proxy::http,
svc, tls,
transport::{self, ClientAddr, Local, Remote, ServerAddr},
transport_header::SessionProtocol,
Error,
};
use crate::ConnectMeta;
use linkerd_app_core::{proxy::http, tls, transport_header::SessionProtocol};

impl<C> Outbound<C> {
pub fn push_tcp_endpoint<T>(
Expand Down
1 change: 0 additions & 1 deletion linkerd/app/outbound/src/tcp/tagged_transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use linkerd_app_core::{
Conditional, Error, Result,
};
use std::{
future::Future,
pin::Pin,
str::FromStr,
task::{Context, Poll},
Expand Down
2 changes: 2 additions & 0 deletions linkerd/duplex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ struct CopyBuf {
write_pos: usize,
}

#[allow(dead_code)]
enum Buffered {
NotEmpty,
Read(usize),
Eof,
}

#[allow(dead_code)]
enum Drained {
BufferEmpty,
Partial(usize),
Expand Down
1 change: 0 additions & 1 deletion linkerd/identity/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ mod credentials;
mod metrics;

use linkerd_error::{Error, Result};
use std::convert::From;
use std::str::FromStr;

pub use self::{
Expand Down
2 changes: 1 addition & 1 deletion linkerd/metrics/src/fmt.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::fmt;
use std::marker::{PhantomData, Sized};
use std::marker::PhantomData;

/// Writes a block of metrics in prometheus-formatted output.
pub trait FmtMetrics {
Expand Down
1 change: 0 additions & 1 deletion linkerd/proxy/core/src/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use futures::prelude::*;
use linkerd_error::Error;
use std::{
fmt::Debug,
future::Future,
net::SocketAddr,
task::{Context, Poll},
};
Expand Down
2 changes: 1 addition & 1 deletion linkerd/proxy/dns-resolve/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![deny(rust_2018_idioms, clippy::disallowed_methods, clippy::disallowed_types)]
#![forbid(unsafe_code)]

use futures::{future, prelude::*, stream};
use futures::prelude::*;
use linkerd_addr::{Addr, NameAddr};
use linkerd_dns as dns;
use linkerd_error::Error;
Expand Down
1 change: 0 additions & 1 deletion linkerd/proxy/http/src/classify/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use linkerd_stack::{layer, ExtractParam, NewService, Service};
use pin_project::{pin_project, pinned_drop};
use std::{
fmt::Debug,
future::Future,
marker::PhantomData,
pin::Pin,
task::{Context, Poll},
Expand Down
2 changes: 1 addition & 1 deletion linkerd/proxy/http/src/h1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use http::{
use linkerd_error::{Error, Result};
use linkerd_http_box::BoxBody;
use linkerd_stack::MakeConnection;
use std::{future::Future, mem, pin::Pin, time::Duration};
use std::{mem, pin::Pin, time::Duration};
use tracing::{debug, trace};

#[derive(Copy, Clone, Debug)]
Expand Down
1 change: 0 additions & 1 deletion linkerd/proxy/http/src/h2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use hyper::{
use linkerd_error::{Error, Result};
use linkerd_stack::{MakeConnection, Service};
use std::{
future::Future,
marker::PhantomData,
pin::Pin,
task::{Context, Poll},
Expand Down
3 changes: 1 addition & 2 deletions linkerd/proxy/http/src/orig_proto.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use super::{h1, h2, upgrade};
use futures::{future, prelude::*};
use futures::prelude::*;
use http::header::{HeaderValue, TRANSFER_ENCODING};
use hyper::body::HttpBody;
use linkerd_error::{Error, Result};
use linkerd_http_box::BoxBody;
use linkerd_stack::{layer, MakeConnection, Service};
use std::{
future::Future,
pin::Pin,
task::{Context, Poll},
};
Expand Down
2 changes: 1 addition & 1 deletion linkerd/proxy/http/src/override_authority.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::h1;
use http::{self, header::AsHeaderName, uri::Authority};
use http::{header::AsHeaderName, uri::Authority};
use linkerd_stack::{layer, NewService, Param};
use std::{
fmt,
Expand Down
4 changes: 1 addition & 3 deletions linkerd/proxy/resolve/src/recover.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
//! A middleware that recovers a resolution after some failures.

use futures::stream::TryStream;
use futures::{prelude::*, ready, FutureExt, Stream};
use futures::{prelude::*, ready};
use linkerd_error::{Error, Recover};
use linkerd_proxy_core::resolve::{self, Update};
use pin_project::pin_project;
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use thiserror::Error;
Expand Down
2 changes: 1 addition & 1 deletion linkerd/proxy/server-policy/src/authz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl Suffix {
#[cfg(feature = "proto")]
pub mod proto {
use super::*;
use crate::{authz::Network, meta::proto::InvalidMeta};
use crate::meta::proto::InvalidMeta;
use linkerd2_proxy_api::{inbound as api, net::InvalidIpNetwork};

#[derive(Debug, thiserror::Error)]
Expand Down
2 changes: 1 addition & 1 deletion linkerd/proxy/tap/src/grpc/match_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::Inspect;
use ipnet::{Ipv4Net, Ipv6Net};
use linkerd2_proxy_api::net::ip_address;
use linkerd2_proxy_api::tap::observe_request;
use std::{boxed::Box, collections::BTreeMap, net, str::FromStr};
use std::{collections::BTreeMap, net, str::FromStr};
use thiserror::Error;

#[derive(Clone, Debug)]
Expand Down
1 change: 0 additions & 1 deletion linkerd/proxy/tap/src/grpc/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use linkerd_conditional::Conditional;
use linkerd_proxy_http::HasH2Reason;
use linkerd_tls as tls;
use pin_project::pin_project;
use std::convert::TryFrom;
use std::iter;
use std::pin::Pin;
use std::sync::atomic::{AtomicUsize, Ordering};
Expand Down
1 change: 0 additions & 1 deletion linkerd/proxy/tcp/src/forward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use linkerd_duplex::Duplex;
use linkerd_error::{Error, Result};
use linkerd_stack::layer;
use std::{
future::Future,
pin::Pin,
task::{Context, Poll},
};
Expand Down
2 changes: 1 addition & 1 deletion linkerd/reconnect/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#[cfg(test)]
mod tests;

use futures::{future, prelude::*, ready};
use futures::{prelude::*, ready};
use linkerd_error::{Error, Recover};
use linkerd_stack::{layer, NewService, Service};
use std::task::{Context, Poll};
Expand Down
2 changes: 1 addition & 1 deletion linkerd/router/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![deny(rust_2018_idioms, clippy::disallowed_methods, clippy::disallowed_types)]
#![forbid(unsafe_code)]

use futures::{future, prelude::*};
use futures::prelude::*;
use linkerd_error::Error;
use linkerd_stack::{layer, ExtractParam, NewService, Oneshot, Service, ServiceExt};
use std::{
Expand Down
2 changes: 1 addition & 1 deletion linkerd/service-profiles/src/default.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{GetProfile, LookupAddr, Receiver};
use futures::{future, prelude::*};
use futures::prelude::*;
use linkerd_error::Error;
use std::task::{Context, Poll};
use tracing::debug;
Expand Down
2 changes: 1 addition & 1 deletion linkerd/service-profiles/src/http/proxy.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::{RequestMatch, Route};
use crate::{Profile, Receiver, ReceiverStream};
use futures::{future, prelude::*};
use futures::prelude::*;
use linkerd_error::{Error, Result};
use linkerd_stack::{layer, NewService, Param, Proxy, Service};
use std::{
Expand Down
2 changes: 1 addition & 1 deletion linkerd/system/src/linux.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use libc::{self, pid_t};
use libc::pid_t;
use procfs::{
process::{self, LimitValue, Process},
ProcResult,
Expand Down
1 change: 0 additions & 1 deletion linkerd/tls/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use linkerd_io as io;
use linkerd_stack::{layer, MakeConnection, NewService, Oneshot, Param, Service, ServiceExt};
use std::{
fmt,
future::Future,
ops::Deref,
pin::Pin,
str::FromStr,
Expand Down
1 change: 0 additions & 1 deletion linkerd/trace-context/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use bytes::Bytes;
use linkerd_error::Error;
use rand::Rng;
use std::collections::HashMap;
use std::convert::TryFrom;
use std::fmt;
use std::time::SystemTime;
use thiserror::Error;
Expand Down
1 change: 0 additions & 1 deletion linkerd/trace-context/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use futures::{future::Either, prelude::*};
use linkerd_stack::layer;
use std::{
collections::HashMap,
future::Future,
pin::Pin,
task::{Context, Poll},
time::SystemTime,
Expand Down

0 comments on commit 457f71b

Please sign in to comment.