Skip to content

Commit 0dd6297

Browse files
committed
chore: run cargo fmt --fix
1 parent 3795ca0 commit 0dd6297

File tree

13 files changed

+350
-272
lines changed

13 files changed

+350
-272
lines changed

edgeless_api/src/grpc_impl/tls_config_mtls.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ impl super::tls_config::TlsConfig {
9090
log::info!("Client CA specified: TLS will be enforced.");
9191
tls_config = tls_config.ca_certificate(tonic::transport::Certificate::from_pem(std::fs::read(ca_path)?));
9292
} /* else {
93-
log::info!("No Client CA specified: no TLS will be enforced.");
94-
} */
93+
log::info!("No Client CA specified: no TLS will be enforced.");
94+
} */
9595

9696
// Configure client certificate for mTLS
9797
if let Some(cert_path) = &self.client_cert_path {
@@ -174,11 +174,11 @@ impl super::tls_config::TlsConfig {
174174
Ok(endpoint.connect().await?)
175175
}
176176
Err(e) => {
177-
// if e.to_string().contains("not found") {
178-
// log::warn!("TLS configuration file 'tls_config.toml' not found. Continuing with plaintext connection (no TLS).");
179-
// } else {
180-
// log::warn!("Failed to load TLS configuration: {}. Continuing with plaintext connection (no TLS).", e);
181-
// }
177+
if e.to_string().contains("not found") {
178+
log::warn!("TLS configuration file 'tls_config.toml' not found. Continuing with plaintext connection (no TLS).");
179+
} else {
180+
log::warn!("Failed to load TLS configuration: {}. Continuing with plaintext connection (no TLS).", e);
181+
}
182182
let endpoint = tonic::transport::Endpoint::from_shared(server_addr.to_string())?;
183183
Ok(endpoint.connect().await?)
184184
}
@@ -190,11 +190,11 @@ impl super::tls_config::TlsConfig {
190190
SERVER_TLS_CONFIG.get_or_init(|| match CombinedTlsConfig::from_file("tls_config.toml") {
191191
Ok(cfg) => cfg.server.unwrap_or_else(super::tls_config::TlsConfig::default),
192192
Err(err) => {
193-
// if err.to_string().contains("not found") {
194-
// log::warn!("TLS configuration file 'tls_config.toml' not found. Using default TLS configuration (no TLS).");
195-
// } else {
196-
// log::warn!("Failed to load server TLS config: {}. Using default TLS configuration (no TLS).", err);
197-
// }
193+
if err.to_string().contains("not found") {
194+
log::warn!("TLS configuration file 'tls_config.toml' not found. Using default TLS configuration (no TLS).");
195+
} else {
196+
log::warn!("Failed to load server TLS config: {}. Using default TLS configuration (no TLS).", err);
197+
}
198198
super::tls_config::TlsConfig::default()
199199
}
200200
})

edgeless_dataplane/src/remote_node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl edgeless_api::invocation::InvocationAPI for RemoteRouter {
7777
async fn handle(&mut self, event: edgeless_api::invocation::Event) -> anyhow::Result<edgeless_api::invocation::LinkProcessingResult> {
7878
if let Some(node_client) = self.receivers.get_mut(&event.target.node_id) {
7979
if let Err(err) = node_client.handle(event).await {
80-
// log::warn!("Error in handling event: {}", err);
80+
log::warn!("Error in handling event: {}", err);
8181
}
8282
Ok(edgeless_api::invocation::LinkProcessingResult::FINAL)
8383
} else {

edgeless_orc/src/bin/proxy_cli.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ fn main() -> anyhow::Result<()> {
142142
println!(
143143
"{} -> {}",
144144
function,
145-
nodes.iter().map(|x| format!("{}({})", x.0, if x.1 { "active" } else { "hot-standby" })).collect::<Vec<String>>().join(",")
145+
nodes
146+
.iter()
147+
.map(|x| format!("{}({})", x.0, if x.1 { "active" } else { "hot-standby" }))
148+
.collect::<Vec<String>>()
149+
.join(",")
146150
);
147151
}
148152
}
@@ -156,7 +160,11 @@ fn main() -> anyhow::Result<()> {
156160
println!(
157161
"{} -> {}",
158162
logical,
159-
physical.iter().map(|x| format!("{}({})", x.0, if x.1 { "active" } else { "standby" })).collect::<Vec<String>>().join(",")
163+
physical
164+
.iter()
165+
.map(|x| format!("{}({})", x.0, if x.1 { "active" } else { "standby" }))
166+
.collect::<Vec<String>>()
167+
.join(",")
160168
);
161169
}
162170
}

edgeless_orc/src/orchestration_logic.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,7 @@ impl OrchestrationLogic {
185185
exclude: &Vec<uuid::Uuid>,
186186
) -> Option<uuid::Uuid> {
187187
let feasible_nodes = self.feasible_nodes(spawn_req, &self.nodes);
188-
let candidates: Vec<uuid::Uuid> = feasible_nodes
189-
.into_iter()
190-
.filter(|node_id| !exclude.contains(node_id))
191-
.collect();
188+
let candidates: Vec<uuid::Uuid> = feasible_nodes.into_iter().filter(|node_id| !exclude.contains(node_id)).collect();
192189
if candidates.is_empty() {
193190
return None;
194191
}
@@ -200,7 +197,7 @@ impl OrchestrationLogic {
200197
}
201198
crate::OrchestrationStrategy::RoundRobin => {
202199
// Prevent infinite loop: evaluate each node at most once.
203-
for _ in 0..candidates.len() {
200+
if let Some(_) = (0..candidates.len()).next() {
204201
// Wrap-around if the current index is out of bounds.
205202
if self.round_robin_current_index >= candidates.len() {
206203
self.round_robin_current_index = 0;

0 commit comments

Comments
 (0)