Skip to content

Commit e2a3f27

Browse files
committed
Define clippy restrictions for the crate
This way, they don't have to be specified from the CLI each time. Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
1 parent 4106357 commit e2a3f27

3 files changed

Lines changed: 20 additions & 6 deletions

File tree

src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33

44
//! High-level interface for the Microgrid API.
55
6+
#![cfg_attr(
7+
not(test),
8+
deny(
9+
clippy::unwrap_used,
10+
clippy::expect_used,
11+
clippy::panic,
12+
clippy::unimplemented,
13+
clippy::todo,
14+
clippy::unreachable,
15+
)
16+
)]
17+
618
mod bounds;
719
pub use bounds::Bounds;
820

src/logical_meter/formula/async_formula.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,11 @@ async fn synchronize_receivers<Q: Quantity>(
157157
for item in formula_items.iter_mut() {
158158
match item.recv().await {
159159
Ok(vv) => latest.push(vv),
160-
Err(_) => todo!(),
160+
Err(e) => {
161+
return Err(crate::Error::internal(format!(
162+
"Failed to receive from formula operand: {e}"
163+
)));
164+
}
161165
};
162166
}
163167

src/microgrid/telemetry_tracker/battery_pool_telemetry_tracker.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,10 @@ impl BatteryPoolTelemetryTracker {
113113
if !group_batteries.is_subset(&self.component_ids) {
114114
let e = format!(
115115
concat!(
116-
"Inverter {} is connected to batteries {:?} which are not all in the ",
117-
"requested component IDs {:?}"
116+
"Inverters {:?} are connected to batteries {:?} which are not all in ",
117+
"the requested component IDs {:?}"
118118
),
119-
group_inverters.iter().next().unwrap(),
120-
group_batteries,
121-
self.component_ids
119+
group_inverters, group_batteries, self.component_ids
122120
);
123121

124122
tracing::error!("{}", e);

0 commit comments

Comments
 (0)