Prechádzať zdrojové kódy

style: cargo fmt on src/power (occupancy-guard helpers) — no behavior change

Alexander Korolev 5 dní pred
rodič
commit
cebff9abb2
2 zmenil súbory, kde vykonal 19 pridanie a 5 odobranie
  1. 12 3
      src/power/tests.rs
  2. 7 2
      src/power/toggle.rs

+ 12 - 3
src/power/tests.rs

@@ -118,10 +118,16 @@ fn off_extras_whole_cluster_keeps_extras_subset_skips_them() {
     // A whole-cluster power off (no --node) turns the shared fabric off too.
     let cfg = cfg_with_ha();
     let c = crate::config::select_cluster_by_name(&cfg, "x").unwrap();
-    assert_eq!(off_extras(&c, &[], &empty), vec!["switch.network_x".to_string()]);
+    assert_eq!(
+        off_extras(&c, &[], &empty),
+        vec!["switch.network_x".to_string()]
+    );
     // A subset power off (--node) must NOT take the shared switch down —
     // the nodes that stay up depend on it (NCCL over the fabric).
-    assert_eq!(off_extras(&c, &["n1".to_string()], &empty), Vec::<String>::new());
+    assert_eq!(
+        off_extras(&c, &["n1".to_string()], &empty),
+        Vec::<String>::new()
+    );
     assert_eq!(
         off_extras(&c, &["n1".to_string(), "n2".to_string()], &empty),
         Vec::<String>::new()
@@ -141,7 +147,10 @@ fn off_extras_whole_cluster_keeps_extra_held_by_other_active_cluster() {
     assert_eq!(off_extras(&c, &[], &held), Vec::<String>::new());
     // an unrelated held entity does not protect this cluster's switch
     let other: HashSet<String> = ["switch.somewhere_else".to_string()].into_iter().collect();
-    assert_eq!(off_extras(&c, &[], &other), vec!["switch.network_x".to_string()]);
+    assert_eq!(
+        off_extras(&c, &[], &other),
+        vec!["switch.network_x".to_string()]
+    );
 }
 
 #[test]

+ 7 - 2
src/power/toggle.rs

@@ -28,7 +28,10 @@ pub(crate) fn extra_ids(cluster: &Cluster) -> Vec<String> {
 /// the offline source of truth (the single-launcher serialization point); a
 /// stale open run over-reports and keeps the entity on — the safe direction
 /// (never cut a shared resource that might still be in use).
-pub(crate) fn extras_held_by_other_clusters(config: &Config, target: &Cluster) -> HashMap<String, Vec<String>> {
+pub(crate) fn extras_held_by_other_clusters(
+    config: &Config,
+    target: &Cluster,
+) -> HashMap<String, Vec<String>> {
     let active: HashSet<String> = crate::runlock::open_runs(config)
         .into_iter()
         .filter_map(|(_, _, cluster)| cluster)
@@ -40,7 +43,9 @@ pub(crate) fn extras_held_by_other_clusters(config: &Config, target: &Cluster) -
             continue;
         }
         for e in &c.extra_entities {
-            held.entry(e.entity().to_string()).or_default().push(c.name.clone());
+            held.entry(e.entity().to_string())
+                .or_default()
+                .push(c.name.clone());
         }
     }
     held