Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: fix some random clippy lints #749

Merged
merged 6 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion linkerd/addr/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![deny(warnings, rust_2018_idioms)]

use http;
use linkerd2_dns_name::Name;
use std::{
fmt,
Expand Down
2 changes: 1 addition & 1 deletion linkerd/app/core/src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl Config {
.push(tls::ConnectLayer::new(identity))
.push_timeout(self.connect.timeout)
.push(self::client::layer())
.push(reconnect::layer(backoff.clone()))
.push(reconnect::layer(backoff))
.push(self::resolve::layer(dns, backoff))
.push_on_response(self::control::balance::layer())
.into_new_service()
Expand Down
2 changes: 1 addition & 1 deletion linkerd/app/inbound/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ impl Config {
connect.h2_settings,
))
.push(reconnect::layer({
let backoff = connect.backoff.clone();
let backoff = connect.backoff;
move |_| Ok(backoff.stream())
}))
.check_new_service::<HttpEndpoint, http::Request<_>>();
Expand Down
2 changes: 1 addition & 1 deletion linkerd/app/integration/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ impl tower::Service<hyper::Uri> for Conn {

fn call(&mut self, _: hyper::Uri) -> Self::Future {
let tls = self.tls.clone();
let conn = TcpStream::connect(self.addr.clone());
let conn = TcpStream::connect(self.addr);
let abs_form = self.absolute_uris;
let running = self
.running
Expand Down
6 changes: 2 additions & 4 deletions linkerd/app/integration/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ impl Proxy {
}

pub fn inbound(mut self, s: server::Listening) -> Self {
let addr = s.addr.clone();
self.inbound = Some(addr);
self.inbound = Some(s.addr);
self.inbound_server = Some(s);
self
}
Expand All @@ -107,8 +106,7 @@ impl Proxy {
}

pub fn outbound(mut self, s: server::Listening) -> Self {
let addr = s.addr.clone();
self.outbound = Some(addr);
self.outbound = Some(s.addr);
self.outbound_server = Some(s);
self
}
Expand Down
2 changes: 1 addition & 1 deletion linkerd/app/outbound/src/http/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ where
.push(http::client::layer(config.h1_settings, config.h2_settings))
// Re-establishes a connection when the client fails.
.push(reconnect::layer({
let backoff = config.backoff.clone();
let backoff = config.backoff;
move |e: Error| {
if tcp::connect::is_loop(&*e) {
Err(e)
Expand Down
4 changes: 2 additions & 2 deletions linkerd/app/profiling/src/bin/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ async fn main() {
.next()
.expect("PROFILING_SUPPORT_SERVER resolved to no addrs!");

let srv = server::mock_listening(addr.clone());
let srv2 = server::mock_listening(addr.clone());
let srv = server::mock_listening(addr);
let srv2 = server::mock_listening(addr);

let ctrl = controller::new();
let transparency_tx = ctrl.destination_tx("transparency.test.svc.cluster.local");
Expand Down
3 changes: 2 additions & 1 deletion linkerd/dns/name/src/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ pub struct InvalidName;

impl Name {
pub fn is_localhost(&self) -> bool {
*self == Name::try_from("localhost.".as_bytes()).unwrap()
use std::str::FromStr;
*self == Name::from_str("localhost.").unwrap()
}

pub fn without_trailing_dot(&self) -> &str {
Expand Down
2 changes: 1 addition & 1 deletion linkerd/exp-backoff/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub struct InvalidBackoff(&'static str);
impl ExponentialBackoff {
pub fn stream(&self) -> ExponentialBackoffStream {
ExponentialBackoffStream {
backoff: self.clone(),
backoff: *self,
rng: SmallRng::from_entropy(),
iterations: 0,
delay: None,
Expand Down
2 changes: 1 addition & 1 deletion linkerd/proxy/http/src/h2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl<C: Clone, B> Clone for Connect<C, B> {
fn clone(&self) -> Self {
Connect {
connect: self.connect.clone(),
h2_settings: self.h2_settings.clone(),
h2_settings: self.h2_settings,
_marker: PhantomData,
}
}
Expand Down
2 changes: 1 addition & 1 deletion linkerd/proxy/transport/src/listen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ mod mock {

impl OrigDstAddr for MockOrigDstAddr {
fn orig_dst_addr(&self, _: &TcpStream) -> Option<SocketAddr> {
Some(self.0.clone())
Some(self.0)
}
}
}
2 changes: 1 addition & 1 deletion linkerd/timeout/src/failfast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ where
// triggering failfast.
Self {
inner: self.inner.clone(),
max_unavailable: self.max_unavailable.clone(),
max_unavailable: self.max_unavailable,
state: State::Open,
}
}
Expand Down