Skip to content

Commit 4106357

Browse files
committed
Improve formatting
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
1 parent 97dc866 commit 4106357

2 files changed

Lines changed: 33 additions & 21 deletions

File tree

src/client/test_utils.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,9 @@ impl MicrogridApiClient for MockMicrogridApiClient {
355355
if let Some(component) = component {
356356
if !component.metrics.is_empty() {
357357
let metrics = component.metrics.clone();
358-
let state_code =
359-
component.state_code.unwrap_or(ElectricalComponentStateCode::Ready);
358+
let state_code = component
359+
.state_code
360+
.unwrap_or(ElectricalComponentStateCode::Ready);
360361
let silence_after_metrics = component.silence_after_metrics;
361362
tokio::spawn(async move {
362363
let dur = std::time::Duration::from_millis(200);

src/microgrid/battery_bounds_tracker.rs

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ where
119119
components
120120
.values()
121121
.filter_map(extract_metric_bounds::<M>)
122-
.fold(Vec::new(), |acc, bounds| combine_parallel_sets(&acc, &bounds))
122+
.fold(Vec::new(), |acc, bounds| {
123+
combine_parallel_sets(&acc, &bounds)
124+
})
123125
}
124126

125127
fn extract_metric_bounds<M: Metric>(
@@ -217,8 +219,9 @@ mod tests {
217219
},
218220
)]);
219221

220-
let bounds =
221-
BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(&snapshot);
222+
let bounds = BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(
223+
&snapshot,
224+
);
222225
assert_eq!(
223226
bounds,
224227
vec![
@@ -263,8 +266,9 @@ mod tests {
263266
},
264267
)]);
265268

266-
let bounds =
267-
BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(&snapshot);
269+
let bounds = BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(
270+
&snapshot,
271+
);
268272
assert_eq!(
269273
bounds,
270274
vec![Bounds::new(
@@ -321,8 +325,9 @@ mod tests {
321325
),
322326
]);
323327

324-
let bounds =
325-
BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(&snapshot);
328+
let bounds = BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(
329+
&snapshot,
330+
);
326331
assert_eq!(
327332
bounds,
328333
vec![Bounds::new(
@@ -335,8 +340,9 @@ mod tests {
335340
#[test]
336341
fn empty_pool_yields_empty_bounds() {
337342
let snapshot = status(vec![]);
338-
let bounds =
339-
BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(&snapshot);
343+
let bounds = BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(
344+
&snapshot,
345+
);
340346
assert!(bounds.is_empty());
341347
}
342348

@@ -367,8 +373,9 @@ mod tests {
367373
},
368374
)]);
369375

370-
let bounds =
371-
BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(&snapshot);
376+
let bounds = BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(
377+
&snapshot,
378+
);
372379
assert!(
373380
bounds.is_empty(),
374381
"group with no inverter bounds must not contribute any bounds"
@@ -400,8 +407,9 @@ mod tests {
400407
},
401408
)]);
402409

403-
let bounds =
404-
BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(&snapshot);
410+
let bounds = BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(
411+
&snapshot,
412+
);
405413
assert!(
406414
bounds.is_empty(),
407415
"group with no battery bounds must not contribute any bounds"
@@ -434,8 +442,9 @@ mod tests {
434442
},
435443
)]);
436444

437-
let bounds =
438-
BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(&snapshot);
445+
let bounds = BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(
446+
&snapshot,
447+
);
439448
assert!(
440449
bounds.is_empty(),
441450
"group with no healthy inverters must not contribute any bounds"
@@ -467,8 +476,9 @@ mod tests {
467476
},
468477
)]);
469478

470-
let bounds =
471-
BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(&snapshot);
479+
let bounds = BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(
480+
&snapshot,
481+
);
472482
assert!(
473483
bounds.is_empty(),
474484
"group with no healthy batteries must not contribute any bounds"
@@ -513,8 +523,9 @@ mod tests {
513523

514524
// Inverter side has no active-power bounds → group produces no
515525
// bounds, so the pool bounds are empty.
516-
let bounds =
517-
BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(&snapshot);
526+
let bounds = BatteryPoolBoundsTracker::<AcPowerActive, AcPowerActive>::compute_pool_bounds(
527+
&snapshot,
528+
);
518529
assert!(bounds.is_empty());
519530
}
520531
}

0 commit comments

Comments
 (0)