Skip to content

Commit a84dfb4

Browse files
author
Jonathan D.A. Jewell
committed
fix: resolve clippy warnings
- Use .clamp() instead of .max().min() in report generator - Use .or_default() instead of .or_insert_with(Vec::new) - Add allow attributes for intentional vulnerabilities in examples - Remove unused import in analyzer tests
1 parent 6830578 commit a84dfb4

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/vulnerable_program.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
//! This program contains intentional bugs for demonstration purposes.
66
//! DO NOT use this code in production!
77
8+
#![allow(clippy::unnecessary_literal_unwrap)]
9+
#![allow(static_mut_refs)]
10+
811
use std::env;
912
use std::sync::{Arc, Mutex};
1013
use std::thread;

src/report/generator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl ReportGenerator {
5858
* 20.0;
5959
score -= (xray.statistics.unsafe_blocks as f64) * 5.0;
6060

61-
score = score.max(0.0).min(100.0);
61+
score = score.clamp(0.0, 100.0);
6262

6363
// Identify critical issues
6464
for result in results {

src/signatures/engine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl SignatureEngine {
181181
if let Fact::Free { var, location } = fact {
182182
free_locations
183183
.entry(var.clone())
184-
.or_insert_with(Vec::new)
184+
.or_default()
185185
.push(*location);
186186
}
187187
}

tests/analyzer_tests.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use panic_attacker::types::*;
66
use panic_attacker::xray;
77
use std::fs;
8-
use std::path::Path;
98
use tempfile::TempDir;
109

1110
fn create_test_file(dir: &TempDir, name: &str, content: &str) -> std::path::PathBuf {

0 commit comments

Comments
 (0)