Skip to content

Commit 1d351fa

Browse files
committed
fix: remove unused non-Windows stubs and fix clippy warnings
- Remove cmd_save and cmd_load non-Windows stubs (never called) - Gate Path import with #[cfg(windows)] - Add clippy allows for intentional exit/stderr usage in main/run
1 parent 3b116bd commit 1d351fa

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

crates/uffs-mft/src/main.rs

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
#[cfg(not(windows))]
3939
use core::future::Future;
4040
use std::io::stdout;
41-
use std::path::{Path, PathBuf};
41+
#[cfg(windows)]
42+
use std::path::Path;
43+
use std::path::PathBuf;
4244

4345
#[cfg(windows)]
4446
use anyhow::Context;
@@ -395,6 +397,7 @@ fn init_logging(verbose: bool) -> tracing_appender::non_blocking::WorkerGuard {
395397
}
396398

397399
#[tokio::main]
400+
#[allow(clippy::print_stderr, clippy::exit)] // Intentional: user-facing error output
398401
async fn main() {
399402
// Check for -v/--verbose flag early
400403
let verbose = std::env::args().any(|arg| arg == "-v" || arg == "--verbose");
@@ -414,6 +417,7 @@ async fn main() {
414417
}
415418

416419
/// Main application logic, separated from `main()` for clean error handling.
420+
#[allow(clippy::exit, clippy::unused_async, clippy::single_call_fn)]
417421
async fn run() -> Result<()> {
418422
// Parse CLI with custom error handling to show help on errors
419423
let cli = match Cli::try_parse() {
@@ -2035,17 +2039,7 @@ async fn cmd_save(
20352039
Ok(())
20362040
}
20372041

2038-
/// Save MFT - non-Windows stub.
2039-
#[cfg(not(windows))]
2040-
#[allow(clippy::unused_async)]
2041-
async fn cmd_save(
2042-
_drive: char,
2043-
_output: &Path,
2044-
_compress: bool,
2045-
_compression_level: i32,
2046-
) -> Result<()> {
2047-
anyhow::bail!("Raw MFT saving is only supported on Windows");
2048-
}
2042+
20492043

20502044
/// Load MFT from a saved file and optionally export.
20512045
#[cfg(windows)]
@@ -2248,9 +2242,4 @@ async fn cmd_load(input: &Path, output: Option<&Path>, info_only: bool) -> Resul
22482242
Ok(())
22492243
}
22502244

2251-
/// Load MFT - non-Windows stub.
2252-
#[cfg(not(windows))]
2253-
#[allow(clippy::unused_async)]
2254-
async fn cmd_load(_input: &Path, _output: Option<&Path>, _info_only: bool) -> Result<()> {
2255-
anyhow::bail!("Raw MFT loading is only supported on Windows");
2256-
}
2245+

0 commit comments

Comments
 (0)