fix(rust): resolve all clippy warnings treated as errors in CI
Fix 18 clippy errors across 7 files: - lib.rs: change doc comment to regular comment (empty line after doc) - arch_audit.rs: replace format!() with string literal, use is_none_or - code_quality.rs: collapsible if, map_or → is_none_or - commit.rs: collapsible match guard - explore.rs: needless_range_loop → iterator enumerate - skills.rs: map_or(false,...) → is_some_and - semantic_search.rs: map_or → is_none_or, sort_by → sort_by_key, remove explicit type to avoid type_complexity CI was failing with 'error: could not compile zesdex-infrastructure due to 18 previous errors' at clippy step.
This commit is contained in:
@@ -146,29 +146,29 @@ pub fn scan_quality_file(file_path: &Path, root: &Path) -> Vec<Finding> {
|
||||
}
|
||||
|
||||
// ── Rule: Missing doc comments on pub items ────────────────────
|
||||
if trimmed.starts_with("pub ") || trimmed.starts_with("pub(") {
|
||||
if !prev_line_doc && !prev_line_empty {
|
||||
// Check it's a struct/enum/fn/trait/type/const/mod
|
||||
let is_item = trimmed.starts_with("pub fn ")
|
||||
|| trimmed.starts_with("pub struct ")
|
||||
|| trimmed.starts_with("pub enum ")
|
||||
|| trimmed.starts_with("pub trait ")
|
||||
|| trimmed.starts_with("pub type ")
|
||||
|| trimmed.starts_with("pub const ")
|
||||
|| trimmed.starts_with("pub mod ")
|
||||
|| trimmed.starts_with("pub(crate) fn ")
|
||||
|| trimmed.starts_with("pub(crate) struct ")
|
||||
|| trimmed.starts_with("pub(crate) enum ")
|
||||
|| trimmed.starts_with("pub(crate) trait ");
|
||||
if is_item {
|
||||
findings.push(Finding {
|
||||
severity: super::arch_audit::Severity::Info,
|
||||
rule: "missing-doc",
|
||||
file: relative.clone(),
|
||||
line: line_num,
|
||||
message: format!("Missing doc comment on pub item: {trimmed}"),
|
||||
});
|
||||
}
|
||||
if (trimmed.starts_with("pub ") || trimmed.starts_with("pub("))
|
||||
&& !prev_line_doc && !prev_line_empty
|
||||
{
|
||||
// Check it's a struct/enum/fn/trait/type/const/mod
|
||||
let is_item = trimmed.starts_with("pub fn ")
|
||||
|| trimmed.starts_with("pub struct ")
|
||||
|| trimmed.starts_with("pub enum ")
|
||||
|| trimmed.starts_with("pub trait ")
|
||||
|| trimmed.starts_with("pub type ")
|
||||
|| trimmed.starts_with("pub const ")
|
||||
|| trimmed.starts_with("pub mod ")
|
||||
|| trimmed.starts_with("pub(crate) fn ")
|
||||
|| trimmed.starts_with("pub(crate) struct ")
|
||||
|| trimmed.starts_with("pub(crate) enum ")
|
||||
|| trimmed.starts_with("pub(crate) trait ");
|
||||
if is_item {
|
||||
findings.push(Finding {
|
||||
severity: super::arch_audit::Severity::Info,
|
||||
rule: "missing-doc",
|
||||
file: relative.clone(),
|
||||
line: line_num,
|
||||
message: format!("Missing doc comment on pub item: {trimmed}"),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,11 +217,11 @@ pub fn scan_quality(root: &Path) -> Result<CodeQualityReport> {
|
||||
let mut files_scanned = 0;
|
||||
|
||||
for entry in Walk::new(&apps_dir).flatten() {
|
||||
if entry.file_type().map_or(true, |ft| !ft.is_file()) {
|
||||
if entry.file_type().is_none_or(|ft| !ft.is_file()) {
|
||||
continue;
|
||||
}
|
||||
let path = entry.path();
|
||||
if path.extension().map_or(true, |e| e != "rs") {
|
||||
if path.extension().is_none_or(|e| e != "rs") {
|
||||
continue;
|
||||
}
|
||||
files_scanned += 1;
|
||||
|
||||
Reference in New Issue
Block a user