Skip to content

Commit 0e44211

Browse files
fix: resolve clippy lints for CI
- Remove needless borrows in prompt_templates.rs few_shot_examples() - Use push('\n') instead of push_str("\n") - Remove duplicated #[cfg] attributes in neo4j_kb.rs and redis.rs - Use struct initialization with ..Default::default() in redis.rs - Replace match with if let for single pattern matches in completions.rs - Use !is_empty() instead of len() > 0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2cb111f commit 0e44211

File tree

4 files changed

+21
-27
lines changed

4 files changed

+21
-27
lines changed

src/ai/neo4j_kb.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
//!
99
//! Requires the `neo4j` feature to be enabled.
1010
11-
#![cfg(feature = "neo4j")]
12-
1311
use anyhow::{Context, Result};
1412
use async_trait::async_trait;
1513
use neo4rs::{Graph, Query};

src/ai/prompt_templates.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ impl VulnCategory {
7777
/// Get few-shot examples for this category
7878
pub fn few_shot_examples(&self) -> &'static [FewShotExample] {
7979
match self {
80-
Self::Injection => &INJECTION_EXAMPLES,
81-
Self::Authentication => &AUTH_EXAMPLES,
82-
Self::Cryptographic => &CRYPTO_EXAMPLES,
83-
Self::DataExposure => &DATA_EXPOSURE_EXAMPLES,
84-
Self::Deserialization => &DESER_EXAMPLES,
85-
Self::Dos => &DOS_EXAMPLES,
86-
Self::ProtocolViolation => &PROTOCOL_EXAMPLES,
80+
Self::Injection => INJECTION_EXAMPLES,
81+
Self::Authentication => AUTH_EXAMPLES,
82+
Self::Cryptographic => CRYPTO_EXAMPLES,
83+
Self::DataExposure => DATA_EXPOSURE_EXAMPLES,
84+
Self::Deserialization => DESER_EXAMPLES,
85+
Self::Dos => DOS_EXAMPLES,
86+
Self::ProtocolViolation => PROTOCOL_EXAMPLES,
8787
Self::Generic => &[],
8888
}
8989
}
@@ -520,7 +520,7 @@ impl AdvancedPromptBuilder {
520520
evidence.description, evidence.data
521521
));
522522
}
523-
prompt.push_str("\n");
523+
prompt.push('\n');
524524
}
525525

526526
// Add CWE references if present

src/cache/redis.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
//! Implements caching using Redis for distributed environments.
44
//! This module is only available when the `redis` feature is enabled.
55
6-
#![cfg(feature = "redis")]
7-
86
use anyhow::{Context, Result};
97
use async_trait::async_trait;
108
use redis::aio::MultiplexedConnection;
@@ -240,8 +238,10 @@ impl Cache for RedisCache {
240238
let pattern = self.category_pattern(*category);
241239
let keys = self.scan_keys(&pattern).await?;
242240

243-
let mut cat_stats = CategoryStats::default();
244-
cat_stats.entries = keys.len() as u64;
241+
let mut cat_stats = CategoryStats {
242+
entries: keys.len() as u64,
243+
..Default::default()
244+
};
245245

246246
// Sum up sizes (approximate - we'd need to fetch each entry)
247247
for key in &keys {

src/cli/completions.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,8 @@ mod tests {
461461
let dir = get_completions_dir(Shell::Bash);
462462

463463
// Restore original
464-
match original {
465-
Some(val) => std::env::set_var("XDG_DATA_HOME", val),
466-
None => {}
464+
if let Some(val) = original {
465+
std::env::set_var("XDG_DATA_HOME", val);
467466
}
468467

469468
// Should fallback to home directory
@@ -500,9 +499,8 @@ mod tests {
500499
let dir = get_completions_dir(Shell::Zsh);
501500

502501
// Restore original
503-
match original {
504-
Some(val) => std::env::set_var("FPATH", val),
505-
None => {}
502+
if let Some(val) = original {
503+
std::env::set_var("FPATH", val);
506504
}
507505

508506
// Should fallback to ~/.zfunc
@@ -536,9 +534,8 @@ mod tests {
536534
let dir = get_completions_dir(Shell::Fish);
537535

538536
// Restore original
539-
match original {
540-
Some(val) => std::env::set_var("XDG_CONFIG_HOME", val),
541-
None => {}
537+
if let Some(val) = original {
538+
std::env::set_var("XDG_CONFIG_HOME", val);
542539
}
543540

544541
// Should fallback to ~/.config/fish/completions
@@ -583,9 +580,8 @@ mod tests {
583580
let dir = get_completions_dir(Shell::Elvish);
584581

585582
// Restore original
586-
match original {
587-
Some(val) => std::env::set_var("XDG_CONFIG_HOME", val),
588-
None => {}
583+
if let Some(val) = original {
584+
std::env::set_var("XDG_CONFIG_HOME", val);
589585
}
590586

591587
// Should fallback to ~/.config/elvish/lib
@@ -821,7 +817,7 @@ mod tests {
821817

822818
// Convert to string and verify it's valid bash
823819
let output = String::from_utf8_lossy(&buffer);
824-
assert!(output.len() > 0);
820+
assert!(!output.is_empty());
825821
}
826822

827823
#[test]

0 commit comments

Comments
 (0)