Skip to content

Commit 6688421

Browse files
authored
clippy fixes (#1596)
* Clippy fixes in runtime Most from cargo +nightly clippy --fix one explicit allow because runtime has deny all. Signed-off-by: clux <[email protected]> * clippy fixes in client and core Signed-off-by: clux <[email protected]> --------- Signed-off-by: clux <[email protected]>
1 parent 3c3939f commit 6688421

File tree

7 files changed

+9
-10
lines changed

7 files changed

+9
-10
lines changed

kube-client/src/api/core_methods.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ where
148148
/// ```no_run
149149
/// # use kube::Api;
150150
/// use k8s_openapi::api::core::v1::Pod;
151-
152151
/// # async fn wrapper() -> Result<(), Box<dyn std::error::Error>> {
153152
/// # let client: kube::Client = todo!();
154153
/// let pods: Api<Pod> = Api::namespaced(client, "apps");
@@ -262,10 +261,8 @@ where
262261
/// use kube::api::{Api, DeleteParams};
263262
/// use k8s_openapi::apiextensions_apiserver::pkg::apis::apiextensions::v1 as apiexts;
264263
/// use apiexts::CustomResourceDefinition;
265-
266264
/// # async fn wrapper() -> Result<(), Box<dyn std::error::Error>> {
267265
/// # let client: kube::Client = todo!();
268-
269266
/// let crds: Api<CustomResourceDefinition> = Api::all(client);
270267
/// crds.delete("foos.clux.dev", &DeleteParams::default()).await?
271268
/// .map_left(|o| println!("Deleting CRD: {:?}", o.status))

kube-core/src/duration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<'de> Deserialize<'de> for Duration {
171171
D: Deserializer<'de>,
172172
{
173173
struct Visitor;
174-
impl<'de> de::Visitor<'de> for Visitor {
174+
impl de::Visitor<'_> for Visitor {
175175
type Value = Duration;
176176

177177
fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

kube-core/src/object.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ impl<T: Clone> ObjectList<T> {
100100
/// *elem = 2;
101101
/// println!("First element: {:?}", elem); // prints "First element: 2"
102102
/// }
103-
104103
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut T> {
105104
self.items.iter_mut()
106105
}

kube-runtime/src/controller/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ const APPLIER_REQUEUE_BUF_SIZE: usize = 100;
332332
/// This is the "hard-mode" version of [`Controller`], which allows you some more customization
333333
/// (such as triggering from arbitrary [`Stream`]s), at the cost of being a bit more verbose.
334334
#[allow(clippy::needless_pass_by_value)]
335+
#[allow(clippy::type_complexity)]
335336
pub fn applier<K, QueueStream, ReconcilerFut, Ctx>(
336337
mut reconciler: impl FnMut(Arc<K>, Arc<Ctx>) -> ReconcilerFut,
337338
error_policy: impl Fn(Arc<K>, &ReconcilerFut::Error, Arc<Ctx>) -> Action,

kube-runtime/src/reflector/store.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
use super::{dispatcher::Dispatcher, Lookup, ObjectRef, ReflectHandle};
1+
use super::{dispatcher::Dispatcher, Lookup, ObjectRef};
2+
#[cfg(feature = "unstable-runtime-subscribe")]
3+
use crate::reflector::ReflectHandle;
24
use crate::{
35
utils::delayed_init::{self, DelayedInit},
46
watcher,

kube-runtime/src/scheduler.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl<T, R: Stream> Scheduler<T, R> {
6565
}
6666
}
6767

68-
impl<'a, T: Hash + Eq + Clone, R> SchedulerProj<'a, T, R> {
68+
impl<T: Hash + Eq + Clone, R> SchedulerProj<'_, T, R> {
6969
/// Attempt to schedule a message into the queue.
7070
///
7171
/// If the message is already in the queue then the earlier `request.run_at` takes precedence.
@@ -147,7 +147,7 @@ pub struct Hold<'a, T, R> {
147147
scheduler: Pin<&'a mut Scheduler<T, R>>,
148148
}
149149

150-
impl<'a, T, R> Stream for Hold<'a, T, R>
150+
impl<T, R> Stream for Hold<'_, T, R>
151151
where
152152
T: Eq + Hash + Clone,
153153
R: Stream<Item = ScheduleRequest<T>>,
@@ -177,7 +177,7 @@ pub struct HoldUnless<'a, T, R, C> {
177177
can_take_message: C,
178178
}
179179

180-
impl<'a, T, R, C> Stream for HoldUnless<'a, T, R, C>
180+
impl<T, R, C> Stream for HoldUnless<'_, T, R, C>
181181
where
182182
T: Eq + Hash + Clone,
183183
R: Stream<Item = ScheduleRequest<T>>,

kube-runtime/src/utils/delayed_init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl<T: Clone + Send + Sync> DelayedInit<T> {
6161
// Using a manually implemented future because we don't want to hold the lock across poll calls
6262
// since that would mean that an unpolled writer would stall all other tasks from being able to poll it
6363
struct Get<'a, T>(&'a DelayedInit<T>);
64-
impl<'a, T> Future for Get<'a, T>
64+
impl<T> Future for Get<'_, T>
6565
where
6666
T: Clone,
6767
{

0 commit comments

Comments
 (0)