Skip to content

Commit faa8746

Browse files
mivertowskiclaude
andcommitted
Fix clippy warnings and address security vulnerabilities
Clippy fixes: - persistent_fdtd.rs: Remove useless format!() on static string - profile.rs: Replace redundant closure with tuple variant (CliError::Validation) - profile.rs: Replace map_or(false, ...) with is_some_and(...) - profile.rs: Remove unnecessary .to_string() in format args for emojis Security fixes: - Update prometheus from 0.13 to 0.14 with default-features = false This removes the protobuf dependency which had GHSA-2gh3-rmm4-6rq5 Remaining security notes: - lru v0.12.5 (GHSA-rhfx-m35p-ff5j) via iced 0.13 - requires iced 0.14 migration with breaking API changes (tracked for future release) - lexical-core v1.0.6 is SAFE (vulnerability was < 1.0.0) - fast-float alerts are false positives (we use fast-float2) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 80ca83a commit faa8746

4 files changed

Lines changed: 18 additions & 25 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ringkernel-cli/src/commands/profile.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ pub async fn execute(
165165
output: Option<&str>,
166166
detailed: bool,
167167
) -> CliResult<()> {
168-
let output_format = OutputFormat::from_str(format).map_err(|e| CliError::Validation(e))?;
168+
let output_format = OutputFormat::from_str(format).map_err(CliError::Validation)?;
169169

170170
let config = ProfileConfig {
171171
kernel: kernel.to_string(),
@@ -197,7 +197,7 @@ pub async fn execute(
197197
// Check if kernel file exists (for file-based profiling)
198198
let kernel_path = Path::new(kernel);
199199
let is_file_based =
200-
kernel_path.exists() && kernel_path.extension().map_or(false, |e| e == "rs");
200+
kernel_path.exists() && kernel_path.extension().is_some_and(|e| e == "rs");
201201

202202
let result = if is_file_based {
203203
profile_kernel_file(&config).await?
@@ -407,15 +407,15 @@ fn format_text(result: &ProfileResult) -> String {
407407
));
408408
output.push_str(&format!(
409409
" {} Profile Results: {}\n",
410-
"📊".to_string(),
410+
"📊",
411411
result.kernel_name.bright_white()
412412
));
413413
output.push_str(&format!(
414414
"{}\n\n",
415415
"═══════════════════════════════════════════════════════════════".bright_cyan()
416416
));
417417

418-
output.push_str(&format!(" {} Timing Statistics\n", "⏱️".to_string()));
418+
output.push_str(&format!(" {} Timing Statistics\n", "⏱️"));
419419
output.push_str(&format!(
420420
" Iterations: {} (+ {} warmup)\n",
421421
result.iterations.to_string().bright_yellow(),
@@ -455,7 +455,7 @@ fn format_text(result: &ProfileResult) -> String {
455455
));
456456

457457
if let Some(ref mem) = result.memory {
458-
output.push_str(&format!(" {} Memory Bandwidth\n", "💾".to_string()));
458+
output.push_str(&format!(" {} Memory Bandwidth\n", "💾"));
459459
output.push_str(&format!(
460460
" Read: {:.2} GB/s\n",
461461
mem.read_bandwidth_gbps

crates/ringkernel-cuda-codegen/src/persistent_fdtd.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ __device__ bool k2h_send(
392392
);
393393

394394
// Energy reduction function
395-
code.push_str(&format!(
395+
code.push_str(
396396
r#"
397397
// ============================================================================
398398
// ENERGY CALCULATION (Parallel Reduction)
@@ -404,27 +404,27 @@ __device__ float block_reduce_energy(
404404
float my_energy,
405405
float* shared_reduce,
406406
int threads_per_block
407-
) {{
407+
) {
408408
int tid = threadIdx.x;
409409
410410
// Store initial value in shared memory
411411
shared_reduce[tid] = my_energy;
412412
__syncthreads();
413413
414414
// Parallel reduction tree
415-
for (int stride = threads_per_block / 2; stride > 0; stride >>= 1) {{
416-
if (tid < stride) {{
415+
for (int stride = threads_per_block / 2; stride > 0; stride >>= 1) {
416+
if (tid < stride) {
417417
shared_reduce[tid] += shared_reduce[tid + stride];
418-
}}
418+
}
419419
__syncthreads();
420-
}}
420+
}
421421
422422
// Return the total for this block (only thread 0 has final sum)
423423
return shared_reduce[0];
424-
}}
424+
}
425425
426-
"#
427-
));
426+
"#,
427+
);
428428

429429
// Halo exchange functions
430430
code.push_str(&format!(

crates/ringkernel-ecosystem/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ candle-core = { version = "0.4", optional = true }
110110
config = { version = "0.14", optional = true, default-features = false, features = ["toml"] }
111111

112112
# Optional: Metrics
113-
prometheus = { version = "0.13", optional = true }
113+
prometheus = { version = "0.14", optional = true, default-features = false }
114114

115115
# Optional: Persistent kernel support (enables cuda feature for full functionality)
116116
ringkernel-cuda = { workspace = true, optional = true, features = ["cuda"] }

0 commit comments

Comments
 (0)