Skip to content

Commit 1687080

Browse files
committed
Fix lint warnings
Signed-off-by: Guvenc Gulce <[email protected]>
1 parent 6400cb9 commit 1687080

File tree

18 files changed

+84
-84
lines changed

18 files changed

+84
-84
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ members = [
1212
]
1313
resolver = "2"
1414

15+
[workspace.lints.clippy]
16+
uninlined_format_args = "warn"
17+
1518
[workspace.package]
1619
version = "0.5.0"
1720
edition = "2021"

cli/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ version.workspace = true
44
edition.workspace = true
55
description = "A gRPC CLI for the FeOS control plane"
66

7+
[lints]
8+
workspace = true
9+
710
[dependencies]
811
# Workspace dependencies
912
feos-proto = { workspace = true }

cli/src/container_commands.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub enum ContainerCommand {
8181
fn parse_key_val(s: &str) -> Result<(String, String), String> {
8282
s.split_once('=')
8383
.map(|(key, value)| (key.to_string(), value.to_string()))
84-
.ok_or_else(|| format!("invalid KEY=value format: {}", s))
84+
.ok_or_else(|| format!("invalid KEY=value format: {s}"))
8585
}
8686

8787
pub async fn handle_container_command(args: ContainerArgs) -> Result<()> {
@@ -113,7 +113,7 @@ async fn create_container(
113113
cmd: Vec<String>,
114114
env: Vec<(String, String)>,
115115
) -> Result<()> {
116-
println!("Requesting container creation with image: {}...", image_ref);
116+
println!("Requesting container creation with image: {image_ref}...");
117117

118118
let config = ContainerConfig {
119119
image_ref,
@@ -140,23 +140,23 @@ async fn create_container(
140140
}
141141

142142
async fn start_container(client: &mut ContainerServiceClient<Channel>, id: String) -> Result<()> {
143-
println!("Requesting to start container: {}...", id);
143+
println!("Requesting to start container: {id}...");
144144
let request = StartContainerRequest {
145145
container_id: id.clone(),
146146
};
147147
client.start_container(request).await?;
148-
println!("Start request sent for container: {}", id);
148+
println!("Start request sent for container: {id}");
149149
Ok(())
150150
}
151151

152152
async fn stop_container(client: &mut ContainerServiceClient<Channel>, id: String) -> Result<()> {
153-
println!("Requesting to stop container: {}...", id);
153+
println!("Requesting to stop container: {id}...");
154154
let request = StopContainerRequest {
155155
container_id: id.clone(),
156156
..Default::default()
157157
};
158158
client.stop_container(request).await?;
159-
println!("Stop request sent for container: {}", id);
159+
println!("Stop request sent for container: {id}");
160160
Ok(())
161161
}
162162

@@ -169,16 +169,16 @@ async fn get_container_info(
169169
};
170170
let response = client.get_container(request).await?.into_inner();
171171

172-
println!("Container Info for: {}", id);
172+
println!("Container Info for: {id}");
173173
println!(
174174
" State: {:?}",
175175
ContainerState::try_from(response.state).unwrap_or(ContainerState::Unspecified)
176176
);
177177
if let Some(pid) = response.pid {
178-
println!(" PID: {}", pid);
178+
println!(" PID: {pid}");
179179
}
180180
if let Some(exit_code) = response.exit_code {
181-
println!(" Exit Code: {}", exit_code);
181+
println!(" Exit Code: {exit_code}");
182182
}
183183
if let Some(config) = response.config {
184184
println!(" Config:");
@@ -223,11 +223,11 @@ async fn list_containers(client: &mut ContainerServiceClient<Channel>) -> Result
223223
}
224224

225225
async fn delete_container(client: &mut ContainerServiceClient<Channel>, id: String) -> Result<()> {
226-
println!("Requesting to delete container: {}...", id);
226+
println!("Requesting to delete container: {id}...");
227227
let request = DeleteContainerRequest {
228228
container_id: id.clone(),
229229
};
230230
client.delete_container(request).await?;
231-
println!("Successfully deleted container: {}", id);
231+
println!("Successfully deleted container: {id}");
232232
Ok(())
233233
}

feos/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name = "feos"
33
version.workspace = true
44
edition.workspace = true
55

6+
[lints]
7+
workspace = true
8+
69
[[bin]]
710
name = "feos"
811
path = "src/main.rs"

feos/proto/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name = "feos-proto"
33
version.workspace = true
44
edition.workspace = true
55

6+
[lints]
7+
workspace = true
8+
69
[lib]
710
path = "src/lib.rs"
811

feos/services/container-service/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name = "container-service"
33
version.workspace = true
44
edition.workspace = true
55

6+
[lints]
7+
workspace = true
8+
69
[dependencies]
710
feos-proto = { workspace = true }
811
image-service = { path = "../image-service" }

feos/services/container-service/src/dispatcher.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl Dispatcher {
8686
let adapter = self.adapter.clone();
8787
tokio::spawn(async move {
8888
if let Err(e) = Self::handle_command(cmd, repo, adapter).await {
89-
warn!("Dispatcher: Error handling command: {}", e);
89+
warn!("Dispatcher: Error handling command: {e}");
9090
}
9191
});
9292
}
@@ -102,7 +102,7 @@ impl Dispatcher {
102102
})?;
103103

104104
repo.get_container(container_id).await?.ok_or_else(|| {
105-
ContainerServiceError::InvalidArgument(format!("Container '{}' not found", id_str))
105+
ContainerServiceError::InvalidArgument(format!("Container '{id_str}' not found"))
106106
})
107107
}
108108

@@ -140,7 +140,7 @@ impl Dispatcher {
140140

141141
let image_uuid_str = initiate_image_pull(&image_ref).await?;
142142
let image_uuid = Uuid::parse_str(&image_uuid_str).map_err(|e| {
143-
ContainerServiceError::ImageService(format!("Invalid image UUID: {}", e))
143+
ContainerServiceError::ImageService(format!("Invalid image UUID: {e}"))
144144
})?;
145145

146146
let record = crate::persistence::ContainerRecord {

feos/services/container-service/src/runtime/adapter.rs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ impl ContainerAdapter {
203203
OciLinuxNamespace {
204204
typ: "mount".to_string(),
205205
},
206-
// OciLinuxNamespace {
207-
// typ: "network".to_string(),
208-
// },
206+
// OciLinuxNamespace {
207+
// typ: "network".to_string(),
208+
// },
209209
],
210210
},
211211
};
@@ -223,24 +223,18 @@ impl ContainerAdapter {
223223
container_id: &str,
224224
bundle_path: &Path,
225225
) -> Result<i64, AdapterError> {
226-
info!("Adapter: Rewriting OCI spec for container {}", container_id);
226+
info!("Adapter: Rewriting OCI spec for container {container_id}");
227227
Self::generate_runtime_spec(bundle_path).await?;
228228

229-
info!(
230-
"Adapter: Connecting to TaskService for container {}",
231-
container_id
232-
);
229+
info!("Adapter: Connecting to TaskService for container {container_id}");
233230
let mut task_client = Self::get_task_service_client().await?;
234231

235232
let bundle_path_str = bundle_path
236233
.to_str()
237234
.ok_or_else(|| AdapterError::Internal("Bundle path is not valid UTF-8".to_string()))?
238235
.to_string();
239236

240-
info!(
241-
"Adapter: Calling Create RPC on TaskService for container {}",
242-
container_id
243-
);
237+
info!("Adapter: Calling Create RPC on TaskService for container {container_id}");
244238
let request = CreateRequest {
245239
container_id: container_id.to_string(),
246240
bundle_path: bundle_path_str,
@@ -252,10 +246,7 @@ impl ContainerAdapter {
252246
let response = task_client.create(request).await?;
253247

254248
let pid = response.into_inner().pid;
255-
info!(
256-
"Adapter: TaskService created container {} with PID {}",
257-
container_id, pid
258-
);
249+
info!("Adapter: TaskService created container {container_id} with PID {pid}");
259250

260251
Ok(pid)
261252
}

feos/services/container-service/src/worker.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ pub async fn handle_create_container(
137137
}
138138
}
139139
Err(e) => {
140-
let error_msg = format!("Adapter failed to create container: {}", e);
140+
let error_msg = format!("Adapter failed to create container: {e}");
141141
error!("ContainerWorker ({container_id}): {error_msg}");
142142
if let Err(e) = repository.delete_container(container_id).await {
143143
warn!("Failed to cleanup DB record for failed creation of {container_id}: {e}");
@@ -157,22 +157,22 @@ pub async fn handle_start_container(
157157

158158
match result {
159159
Ok(_) => {
160-
info!("Worker: Start command sent for container {}", id_str);
160+
info!("Worker: Start command sent for container {id_str}");
161161
let container_id = Uuid::parse_str(&id_str).unwrap();
162162
if let Err(e) = repository
163163
.update_container_state(container_id, ContainerState::Running)
164164
.await
165165
{
166166
let err = ContainerServiceError::Persistence(e);
167-
error!("Worker: {}", err);
167+
error!("Worker: {err}");
168168
let _ = responder.send(Err(err));
169169
return;
170170
}
171171
let _ = responder.send(Ok(StartContainerResponse {}));
172172
}
173173
Err(e) => {
174174
let err = ContainerServiceError::Adapter(e.to_string());
175-
error!("Worker: {}", err);
175+
error!("Worker: {err}");
176176
let _ = responder.send(Err(err));
177177
}
178178
}
@@ -190,22 +190,22 @@ pub async fn handle_stop_container(
190190

191191
match result {
192192
Ok(_) => {
193-
info!("Worker: Stop command sent for container {}", id_str);
193+
info!("Worker: Stop command sent for container {id_str}");
194194
let container_id = Uuid::parse_str(&id_str).unwrap();
195195
if let Err(e) = repository
196196
.update_container_state(container_id, ContainerState::Stopped)
197197
.await
198198
{
199199
let err = ContainerServiceError::Persistence(e);
200-
error!("Worker: {}", err);
200+
error!("Worker: {err}");
201201
let _ = responder.send(Err(err));
202202
return;
203203
}
204204
let _ = responder.send(Ok(StopContainerResponse {}));
205205
}
206206
Err(e) => {
207207
let err = ContainerServiceError::Adapter(e.to_string());
208-
error!("Worker: {}", err);
208+
error!("Worker: {err}");
209209
let _ = responder.send(Err(err));
210210
}
211211
}
@@ -222,19 +222,19 @@ pub async fn handle_delete_container(
222222

223223
match result {
224224
Ok(_) => {
225-
info!("Worker: Delete command sent for container {}", id_str);
225+
info!("Worker: Delete command sent for container {id_str}");
226226
let container_id = Uuid::parse_str(&id_str).unwrap();
227227
if let Err(e) = repository.delete_container(container_id).await {
228228
let err = ContainerServiceError::Persistence(e);
229-
error!("Worker: {}", err);
229+
error!("Worker: {err}");
230230
let _ = responder.send(Err(err));
231231
return;
232232
}
233233
let _ = responder.send(Ok(DeleteContainerResponse {}));
234234
}
235235
Err(e) => {
236236
let err = ContainerServiceError::Adapter(e.to_string());
237-
error!("Worker: {}", err);
237+
error!("Worker: {err}");
238238
let _ = responder.send(Err(err));
239239
}
240240
}

feos/services/host-service/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name = "host-service"
33
version.workspace = true
44
edition.workspace = true
55

6+
[lints]
7+
workspace = true
8+
69
[dependencies]
710
feos-utils = { path = "../../utils" }
811
feos-proto = { workspace = true }

0 commit comments

Comments
 (0)