Skip to content

Commit d327cf4

Browse files
committed
Tooling Rust: Require reasoning in lint exceptions
- Added #![warn(clippy::allow_attributes_without_reason)] - Added reasoning everywhere
1 parent fe0810e commit d327cf4

24 files changed

Lines changed: 52 additions & 45 deletions

apps/desktop/src-tauri/src/benchmark.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
//! All events are logged to stderr with microsecond timestamps.
55
66
// Benchmarks intentionally use eprintln! for raw stderr output (not log framework)
7-
#![allow(clippy::print_stderr)]
7+
#![allow(
8+
clippy::print_stderr,
9+
reason = "Benchmarks bypass log framework for raw stderr output"
10+
)]
811

912
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
1013

apps/desktop/src-tauri/src/commands/file_system.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ pub fn get_listing_stats(
233233
/// Logs a frontend benchmark event to stderr (unified timeline with Rust events).
234234
/// Only logs if RUSTY_COMMANDER_BENCHMARK=1 is set.
235235
#[tauri::command]
236-
#[allow(clippy::print_stderr)] // Benchmark output intentionally bypasses log framework
236+
#[allow(clippy::print_stderr, reason = "Benchmark output intentionally bypasses log framework")]
237237
pub fn benchmark_log(message: String) {
238238
if crate::benchmark::is_enabled() {
239239
eprintln!("{}", message);

apps/desktop/src-tauri/src/file_system/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ pub use operations::{
3333
#[cfg(test)]
3434
pub use provider::FileSystemProvider;
3535
// Re-export volume types (some not used externally yet)
36-
#[allow(unused_imports)]
36+
#[allow(unused_imports, reason = "Public API re-exports for future use")]
3737
pub use volume::{InMemoryVolume, LocalPosixVolume, Volume, VolumeError};
38-
#[allow(unused_imports)]
38+
#[allow(unused_imports, reason = "Public API re-exports for future use")]
3939
pub use volume_manager::VolumeManager;
4040
// Watcher management - init_watcher_manager must be called from lib.rs
4141
pub use watcher::init_watcher_manager;
@@ -60,7 +60,7 @@ pub fn init_volume_manager() {
6060
}
6161

6262
/// Returns a reference to the global volume manager.
63-
#[allow(dead_code)] // Will be used in Phase 4.2 when commands use it
63+
#[allow(dead_code, reason = "Will be used in Phase 4.2 when commands use it")]
6464
pub fn get_volume_manager() -> &'static VolumeManager {
6565
&VOLUME_MANAGER
6666
}

apps/desktop/src-tauri/src/file_system/operations.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! File system operations: read, list, copy, move, delete.
22
3-
#![allow(dead_code)] // Boilerplate for future use
3+
#![allow(dead_code, reason = "Boilerplate for future use")]
44

55
use serde::{Deserialize, Serialize};
66
use std::collections::HashMap;
@@ -1267,7 +1267,7 @@ pub async fn list_directory_start_streaming(
12671267
/// Reads a directory with progress reporting.
12681268
///
12691269
/// This function runs on a blocking thread pool and emits progress events.
1270-
#[allow(clippy::too_many_arguments)]
1270+
#[allow(clippy::too_many_arguments, reason = "Streaming operation requires many state parameters")]
12711271
fn read_directory_with_progress(
12721272
app: &tauri::AppHandle,
12731273
listing_id: &str,

apps/desktop/src-tauri/src/file_system/sync_status.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ pub fn get_sync_statuses(paths: Vec<String>) -> HashMap<String, SyncStatus> {
115115
/// Gets sync status for multiple paths with configurable parallelism.
116116
///
117117
/// Uses a Rayon thread pool with the specified number of threads.
118-
#[allow(dead_code)] // Used for benchmarking
118+
#[allow(dead_code, reason = "Used for benchmarking")]
119119
pub fn get_sync_statuses_with_threads(paths: Vec<String>, num_threads: usize) -> HashMap<String, SyncStatus> {
120120
let pool = rayon::ThreadPoolBuilder::new()
121121
.num_threads(num_threads)

apps/desktop/src-tauri/src/file_system/volume/in_memory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::sync::RwLock;
1313
/// Entry in the in-memory file system.
1414
struct InMemoryEntry {
1515
metadata: FileEntry,
16-
#[allow(dead_code)] // Will be used for future read_file support
16+
#[allow(dead_code, reason = "Will be used for future read_file support")]
1717
content: Option<Vec<u8>>,
1818
}
1919

apps/desktop/src-tauri/src/file_system/volume/local_posix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Local POSIX file system volume implementation.
22
33
use super::{Volume, VolumeError};
4-
use crate::file_system::FileEntry;
54
use crate::file_system::operations::{get_single_entry, list_directory_core};
5+
use crate::file_system::FileEntry;
66
use std::path::{Path, PathBuf};
77

88
/// A volume backed by the local POSIX file system.

apps/desktop/src-tauri/src/file_system/volume/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! enabling different storage backends (local filesystem, in-memory for testing, etc.).
55
66
// TODO: Remove this once Volume is integrated into operations.rs (Phase 2)
7-
#![allow(dead_code)]
7+
#![allow(dead_code, reason = "Volume abstraction not yet integrated into operations.rs")]
88

99
use super::FileEntry;
1010
use std::path::Path;

apps/desktop/src-tauri/src/file_system/volume_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! It tracks both the available volumes and which one is the current default.
55
66
// TODO: Remove this once VolumeManager is used in lib.rs (Phase 4)
7-
#![allow(dead_code)]
7+
#![allow(dead_code, reason = "VolumeManager not yet integrated into lib.rs")]
88

99
use super::volume::Volume;
1010
use std::collections::HashMap;

apps/desktop/src-tauri/src/file_system/watcher.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
//! Uses the unified LISTING_CACHE from operations.rs (no duplicate cache).
55
66
use notify_debouncer_full::{
7-
DebounceEventResult, Debouncer, RecommendedCache, new_debouncer,
7+
new_debouncer,
88
notify::{RecommendedWatcher, RecursiveMode},
9+
DebounceEventResult, Debouncer, RecommendedCache,
910
};
1011
use serde::{Deserialize, Serialize};
1112
use std::collections::HashMap;
@@ -14,7 +15,7 @@ use std::sync::{LazyLock, RwLock};
1415
use std::time::Duration;
1516
use tauri::{AppHandle, Emitter};
1617

17-
use super::operations::{FileEntry, get_listing_entries, list_directory_core, update_listing_entries};
18+
use super::operations::{get_listing_entries, list_directory_core, update_listing_entries, FileEntry};
1819

1920
/// Debounce duration in milliseconds
2021
const DEBOUNCE_MS: u64 = 200;
@@ -49,7 +50,7 @@ pub struct DirectoryDiff {
4950
/// NOTE: No `entries` field - we use the unified LISTING_CACHE instead.
5051
struct WatchedDirectory {
5152
sequence: u64,
52-
#[allow(dead_code)] // Debouncer must be held to keep watching
53+
#[allow(dead_code, reason = "Debouncer must be held to keep watching")]
5354
debouncer: Debouncer<RecommendedWatcher, RecommendedCache>,
5455
}
5556

0 commit comments

Comments
 (0)