Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
olix0r committed Nov 3, 2023
1 parent 99f1ff3 commit 04ea72d
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 16 deletions.
3 changes: 2 additions & 1 deletion linkerd/app/inbound/src/policy/http/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ macro_rules! new_svc {
connection: $conn,
metrics: HttpAuthzMetrics::default(),
inner: |(permit, _): (HttpRoutePermit, ())| {
let f = $rsp;
svc::mk(move |req: ::http::Request<hyper::Body>| {
futures::future::ready($rsp(permit.clone(), req))
futures::future::ready((f)(permit.clone(), req))
})
},
};
Expand Down
1 change: 0 additions & 1 deletion linkerd/app/integration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ use socket2::Socket;
pub use std::collections::HashMap;
use std::fmt;
pub use std::future::Future;
use std::io;
pub use std::net::SocketAddr;
use std::pin::Pin;
pub use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion linkerd/app/integration/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ impl Labels {
/// the values from `other` overwrite the values in `self`.
pub fn and(&self, other: Labels) -> Labels {
let mut new_labels = self.0.clone();
new_labels.extend(other.0.into_iter());
new_labels.extend(other.0);
Labels(new_labels)
}

Expand Down
1 change: 0 additions & 1 deletion linkerd/app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ impl Config {
// Build a task that initializes and runs the proxy stacks.
let start_proxy = {
let identity_ready = identity.ready();
let inbound_addr = inbound_addr;
let profiles = dst.profiles;
let resolve = dst.resolve;

Expand Down
6 changes: 3 additions & 3 deletions linkerd/http-metrics/src/requests/service.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{ClassMetrics, Metrics, StatusMetrics};
use super::{Metrics, StatusMetrics};
use futures::{ready, TryFuture};
use http_body::Body;
use linkerd_error::Error;
Expand Down Expand Up @@ -390,12 +390,12 @@ fn measure_class<C: Hash + Eq>(
let status_metrics = metrics
.by_status
.entry(status)
.or_insert_with(StatusMetrics::default);
.or_default();

let class_metrics = status_metrics
.by_class
.entry(class)
.or_insert_with(ClassMetrics::default);
.or_default();

class_metrics.total.incr();
}
Expand Down
2 changes: 1 addition & 1 deletion linkerd/http-route/src/http/match/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ mod tests {

#[test]
fn path_regex() {
let m = MatchPath::Regex(r#"/foo/\d+"#.parse().unwrap());
let m = MatchPath::Regex(r"/foo/\d+".parse().unwrap());
assert_eq!(
m.match_length(&"/foo/4".parse().unwrap()),
Some(PathMatch::Regex("/foo/4".len()))
Expand Down
2 changes: 1 addition & 1 deletion linkerd/metrics/src/scopes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl<L: FmtLabels + Hash + Eq, S> Scopes<L, S> {

impl<L: FmtLabels + Hash + Eq, S: Default> Scopes<L, S> {
pub fn get_or_default(&mut self, key: L) -> &mut S {
self.0.entry(key).or_insert_with(S::default)
self.0.entry(key).or_default()
}
}

Expand Down
2 changes: 1 addition & 1 deletion linkerd/opencensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ where
match tx.reserve().await {
Ok(tx) => {
let msg = ExportTraceServiceRequest {
spans: accum.drain(..).collect(),
spans: std::mem::take(accum),
node: node.take(),
..Default::default()
};
Expand Down
2 changes: 1 addition & 1 deletion linkerd/proxy/client-policy/src/opaq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub(crate) mod proto {
Ok(Policy {
meta: meta.clone(),
filters: NO_FILTERS.clone(),
failure_policy: NonIoErrors::default(),
failure_policy: NonIoErrors,
distribution,
// Request timeouts are ignored on opaque routes.
request_timeout: None,
Expand Down
2 changes: 1 addition & 1 deletion linkerd/stack/metrics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ where
.0
.lock()
.entry(labels)
.or_insert_with(Default::default)
.or_default()
.clone();
TrackServiceLayer::new(metrics)
}
Expand Down
4 changes: 1 addition & 3 deletions linkerd/stack/src/fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ impl<U, E> Default for Fail<U, E> {

impl<U, E> Clone for Fail<U, E> {
fn clone(&self) -> Self {
Self {
_marker: self._marker,
}
*self
}
}

Expand Down
2 changes: 1 addition & 1 deletion linkerd/stack/src/unwrap_or.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl<T, U: Default> Predicate<Option<T>> for UnwrapOr<U> {

impl<U> Clone for UnwrapOr<U> {
fn clone(&self) -> Self {
Self(self.0)
*self
}
}

Expand Down

0 comments on commit 04ea72d

Please sign in to comment.