Skip to content

Commit 5d76731

Browse files
committed
fix linter
1 parent 4596b38 commit 5d76731

File tree

1 file changed

+27
-17
lines changed

1 file changed

+27
-17
lines changed

src/container_runtime.rs

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ impl ContainerRuntimeManager {
8181
let mut map: HashMap<String, String> = std::collections::HashMap::new();
8282
map.insert("io.kubernetes.pod.uid".to_string(), pod_uid.clone());
8383

84-
85-
let ready_state = cri::PodSandboxStateValue{
84+
let ready_state = cri::PodSandboxStateValue {
8685
state: 0, // PodSandboxState::SandboxReady
8786
};
8887

@@ -303,16 +302,18 @@ mod tests {
303302
.into_iter()
304303
.filter(|sandbox| {
305304
// Filter by label selector
306-
let labels_match = filter.label_selector.iter().all(|(key, expected_value)| {
307-
sandbox
308-
.labels
309-
.get(key)
310-
.map_or(false, |actual_value| actual_value == expected_value)
311-
});
305+
let labels_match =
306+
filter.label_selector.iter().all(|(key, expected_value)| {
307+
sandbox
308+
.labels
309+
.get(key)
310+
.map_or(false, |actual_value| actual_value == expected_value)
311+
});
312312
// Filter by state if specified
313-
let state_match = filter.state.as_ref().map_or(true, |state_filter| {
314-
sandbox.state == state_filter.state
315-
});
313+
let state_match = filter
314+
.state
315+
.as_ref()
316+
.map_or(true, |state_filter| sandbox.state == state_filter.state);
316317
labels_match && state_match
317318
})
318319
.collect()
@@ -343,17 +344,20 @@ mod tests {
343344
container.pod_sandbox_id == filter.pod_sandbox_id
344345
};
345346
// Filter by state if specified
346-
let state_match = filter.state.as_ref().map_or(true, |state_filter| {
347-
container.state == state_filter.state
348-
});
347+
let state_match = filter
348+
.state
349+
.as_ref()
350+
.map_or(true, |state_filter| container.state == state_filter.state);
349351
sandbox_match && state_match
350352
})
351353
.collect()
352354
} else {
353355
containers
354356
};
355357

356-
Ok(Response::new(ListContainersResponse { containers: filtered }))
358+
Ok(Response::new(ListContainersResponse {
359+
containers: filtered,
360+
}))
357361
}
358362

359363
async fn container_status(
@@ -483,7 +487,10 @@ mod tests {
483487
async fn setup_mock_server(
484488
mock: MockRuntimeService,
485489
socket_path: &str,
486-
) -> (RuntimeServiceClient<tonic::transport::Channel>, tokio::task::JoinHandle<()>) {
490+
) -> (
491+
RuntimeServiceClient<tonic::transport::Channel>,
492+
tokio::task::JoinHandle<()>,
493+
) {
487494
let _ = std::fs::remove_file(socket_path);
488495
let uds = UnixListener::bind(socket_path).expect("failed to bind UDS");
489496
let incoming = UnixListenerStream::new(uds);
@@ -560,7 +567,10 @@ mod tests {
560567
state: 0, // SANDBOX_READY
561568
labels: {
562569
let mut m = HashMap::new();
563-
m.insert("io.kubernetes.pod.uid".into(), "pod-with-exited-containers".into());
570+
m.insert(
571+
"io.kubernetes.pod.uid".into(),
572+
"pod-with-exited-containers".into(),
573+
);
564574
m
565575
},
566576
..Default::default()

0 commit comments

Comments
 (0)