fix: resolve all cargo clippy warnings

- Fix toml version requirement metadata warning
- Replace clone() with std::slice::from_ref()
- Collapse nested if statements
- Add #[allow(dead_code)] to test utility functions
- Fix unused imports and variables in tests
- Use unwrap_or_else instead of expect with format!
This commit is contained in:
2026-02-15 12:55:26 +03:00
parent d9457018fd
commit 1229235ac7
12 changed files with 23 additions and 30 deletions

View File

@@ -2,7 +2,6 @@
//!
//! These tests verify that the caching functionality works correctly.
use std::path::Path;
use std::fs;
use tempfile::TempDir;
use wtismycode_core::{Config, python_analyzer::PythonAnalyzer};

View File

@@ -3,7 +3,6 @@
//! These tests verify that the enhanced analysis functionality works correctly
//! with complex code that includes integrations, calls, and docstrings.
use std::fs;
use std::path::Path;
use wtismycode_core::{Config, scanner::FileScanner, python_analyzer::PythonAnalyzer};

View File

@@ -139,7 +139,7 @@ fn test_cycle_detection_no_cycles() {
#[test]
fn test_renderer_produces_output() {
let config = Config::default();
let _config = Config::default();
let model = ProjectModel::new();
let renderer = Renderer::new();
let result = renderer.render_architecture_md(&model, None);

View File

@@ -5,7 +5,6 @@
mod test_utils;
use std::fs;
use std::path::Path;
use wtismycode_core::{Config, scanner::FileScanner, python_analyzer::PythonAnalyzer};

View File

@@ -1,19 +1,21 @@
//! Test utilities for golden tests
use std::fs;
use std::path::Path;
/// Read a file and return its contents
#[allow(dead_code)]
pub fn read_test_file(path: &str) -> String {
fs::read_to_string(path).expect(&format!("Failed to read test file: {}", path))
fs::read_to_string(path).unwrap_or_else(|_| panic!("Failed to read test file: {}", path))
}
/// Write content to a file for testing
#[allow(dead_code)]
pub fn write_test_file(path: &str, content: &str) {
fs::write(path, content).expect(&format!("Failed to write test file: {}", path))
fs::write(path, content).unwrap_or_else(|_| panic!("Failed to write test file: {}", path))
}
/// Compare two strings and panic if they don't match
#[allow(dead_code)]
pub fn assert_strings_equal(actual: &str, expected: &str, message: &str) {
if actual != expected {
panic!("{}: Strings do not match\nActual:\n{}\nExpected:\n{}", message, actual, expected);

View File

@@ -35,7 +35,7 @@ fn test_project_analysis() {
// Integration flags are now set during resolve_symbols, not parse_module
// So we resolve and check there
let project_model = analyzer.resolve_symbols(&[core_module.clone()]).unwrap();
let project_model = analyzer.resolve_symbols(std::slice::from_ref(&core_module)).unwrap();
let db_integration_found = project_model.symbols.values().any(|s| s.integrations_flags.db);
let http_integration_found = project_model.symbols.values().any(|s| s.integrations_flags.http);