diff --git a/k8s-openapi-tests/src/custom_resource_definition.rs b/k8s-openapi-tests/src/custom_resource_definition.rs index beed3f325..7aaed4371 100644 --- a/k8s-openapi-tests/src/custom_resource_definition.rs +++ b/k8s-openapi-tests/src/custom_resource_definition.rs @@ -241,8 +241,7 @@ async fn test() { // Watch CR { let (request, response_body) = FooBar::watch("default", Default::default()).expect("couldn't watch FooBars"); - let foo_bar_watch_events = client.get_multiple_values(request, response_body); - futures_util::pin_mut!(foo_bar_watch_events); + let foo_bar_watch_events = std::pin::pin!(client.get_multiple_values(request, response_body)); let _ = foo_bar_watch_events .filter_map(|foo_bar_watch_event| { diff --git a/k8s-openapi-tests/src/lib.rs b/k8s-openapi-tests/src/lib.rs index 9e9fadafe..e5e29208f 100644 --- a/k8s-openapi-tests/src/lib.rs +++ b/k8s-openapi-tests/src/lib.rs @@ -165,8 +165,7 @@ impl Client { request: http::Request>, response_body: fn(http::StatusCode) -> k8s_openapi::ResponseBody, ) -> (R, http::StatusCode) where R: k8s_openapi::Response { - let stream = self.get_multiple_values(request, response_body); - futures_util::pin_mut!(stream); + let mut stream = std::pin::pin!(self.get_multiple_values(request, response_body)); stream.next().await.expect("unexpected EOF") } diff --git a/k8s-openapi-tests/src/logs.rs b/k8s-openapi-tests/src/logs.rs index a1b12a043..b9746e4db 100644 --- a/k8s-openapi-tests/src/logs.rs +++ b/k8s-openapi-tests/src/logs.rs @@ -38,10 +38,9 @@ async fn get() { }) .expect("couldn't get apiserver pod logs"); let mut apiserver_logs = String::new(); - let chunks = client.get_multiple_values(request, response_body); - futures_util::pin_mut!(chunks); - let mut found_line = false; - while let Some(chunk) = chunks.next().await { + let mut chunks = std::pin::pin!(client.get_multiple_values(request, response_body)); + let found_line = loop { + let Some(chunk) = chunks.next().await else { break false; }; let s = match chunk { (api::ReadPodLogResponse::Ok(s), _) => s, (other, status_code) => panic!("{other:?} {status_code}"), @@ -49,14 +48,13 @@ async fn get() { apiserver_logs.push_str(&s); if apiserver_logs.contains("Serving securely on [::]:6443") { - found_line = true; - break; + break true; } if apiserver_logs.len() > 65536 { - break; + break false; } - } + }; assert!(found_line, "did not find expected text in apiserver pod logs: {apiserver_logs}"); } diff --git a/k8s-openapi-tests/src/watch_event.rs b/k8s-openapi-tests/src/watch_event.rs index 7195e7a8e..aca94cb45 100644 --- a/k8s-openapi-tests/src/watch_event.rs +++ b/k8s-openapi-tests/src/watch_event.rs @@ -9,8 +9,7 @@ async fn watch_pods() { let (request, response_body) = api::Pod::watch("kube-system", Default::default()).expect("couldn't watch pods"); - let pod_watch_events = client.get_multiple_values(request, response_body); - futures_util::pin_mut!(pod_watch_events); + let pod_watch_events = std::pin::pin!(client.get_multiple_values(request, response_body)); let apiserver_pod = pod_watch_events @@ -60,8 +59,7 @@ async fn watch_pods_without_initial_events() { send_initial_events: Some(true), ..Default::default() }).expect("couldn't watch pods"); - let pod_watch_events = client.get_multiple_values(request, response_body); - futures_util::pin_mut!(pod_watch_events); + let pod_watch_events = std::pin::pin!(client.get_multiple_values(request, response_body)); let initial_events_end_annotation = pod_watch_events