Skip to content

Commit 42e28af

Browse files
githubrobbiclaude
andcommitted
fix(uffs-mft): convert last 2 blanket #[allow(dead_code)] to #[expect] + rustfmt
Convert FILE_NAME_WIN32 and FILE_NAME_WIN32_DOS constants from #[allow(dead_code)] to #[expect(dead_code, reason="...")] to match the pattern established across all other crates. Also applies rustfmt to fix formatting drift from the merge to main. Result: 0 blanket #[allow] remaining across all in-scope crates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b080de6 commit 42e28af

File tree

12 files changed

+118
-87
lines changed

12 files changed

+118
-87
lines changed

crates/uffs-cli/src/commands.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,8 +1607,9 @@ fn results_to_dataframe(
16071607
// For directories (including reparse), always prefer the record's tree metrics
16081608
// to ensure we get the computed values from cpp_tree, not potentially stale
16091609
// values from SearchResult.
1610-
// C++ parity: ADS entries (stream_index > 0) have descendants/treesize/tree_allocated = 0.
1611-
// Only the default stream (stream_index == 0) gets tree metrics.
1610+
// C++ parity: ADS entries (stream_index > 0) have
1611+
// descendants/treesize/tree_allocated = 0. Only the default stream
1612+
// (stream_index == 0) gets tree metrics.
16121613
let (desc, tsize, talloc) = if result.stream_index > 0 {
16131614
// ADS stream: no tree metrics
16141615
(0_u32, 0_u64, 0_u64)

crates/uffs-cli/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,13 @@ use std::io;
4646
use std::path::{Path, PathBuf};
4747

4848
use anyhow::Result;
49+
use chrono as _;
4950
use clap::{Parser, Subcommand};
5051
use mimalloc::MiMalloc;
5152
use tracing_subscriber::fmt::time::UtcTime;
5253
use tracing_subscriber::layer::SubscriberExt;
5354
use tracing_subscriber::{EnvFilter, Layer};
54-
use {chrono as _, uffs_polars as _};
55+
use uffs_polars as _;
5556

5657
/// Use mimalloc globally - faster than system allocator for our workload:
5758
/// many small allocations (file names, records) + large buffers (MFT,

crates/uffs-core/src/compiled_pattern.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ impl CompiledPattern {
227227
Self::ContainsAny(patterns) => {
228228
if case_sensitive {
229229
let series = Series::new(PlSmallStr::EMPTY, patterns);
230-
col_expr.str().contains_any(lit(series).implode(true), false)
230+
col_expr
231+
.str()
232+
.contains_any(lit(series).implode(true), false)
231233
} else {
232234
// Use ascii_case_insensitive=true for case-insensitive matching
233235
let series = Series::new(PlSmallStr::EMPTY, patterns);

crates/uffs-core/src/tree.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,7 @@ pub fn apply_directory_treesize(df: &DataFrame) -> Result<DataFrame> {
600600
let has_stream_name = df.column("stream_name").is_ok();
601601

602602
let is_default_dir = if has_stream_name {
603-
col("is_directory")
604-
.and(col("stream_name").eq(lit("")))
603+
col("is_directory").and(col("stream_name").eq(lit("")))
605604
} else {
606605
col("is_directory")
607606
};

crates/uffs-diag/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010

1111
// Keep dependencies wired in for version-locking, even though the library
1212
// portion does not use them directly (the binaries do).
13-
use {anyhow as _, chrono as _, rayon as _, uffs_mft as _, uffs_polars as _};
13+
use anyhow as _;
14+
use chrono as _;
15+
use rayon as _;
16+
use uffs_mft as _;
17+
use uffs_polars as _;
1418

1519
/// Windows-only helpers for inspecting the full uffs-mft raw->fixup->parse
1620
/// pipeline for a single FRS.

crates/uffs-mft/benches/mft_read.rs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,26 @@
1212
//! ```
1313
1414
// Suppress unused crate warnings for dependencies used by the main crate.
15-
use {
16-
anyhow as _, bitflags as _, chrono as _, clap as _, criterion as _, dirs_next as _,
17-
hostname as _, indicatif as _, num_cpus as _, proptest as _, rayon as _, rustc_hash as _,
18-
smallvec as _, thiserror as _, tokio as _, tracing as _, tracing_appender as _,
19-
tracing_subscriber as _, uffs_mft as _, uffs_polars as _,
20-
};
15+
use anyhow as _;
16+
use bitflags as _;
17+
use chrono as _;
18+
use clap as _;
19+
use criterion as _;
20+
use dirs_next as _;
21+
use hostname as _;
22+
use indicatif as _;
23+
use num_cpus as _;
24+
use proptest as _;
25+
use rayon as _;
26+
use rustc_hash as _;
27+
use smallvec as _;
28+
use thiserror as _;
29+
use tokio as _;
30+
use tracing as _;
31+
use tracing_appender as _;
32+
use tracing_subscriber as _;
33+
use uffs_mft as _;
34+
use uffs_polars as _;
2135

2236
#[cfg(feature = "zstd")]
2337
extern crate zstd as _;

crates/uffs-mft/src/cpp_types.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,7 +1718,10 @@ const FRH_IN_USE: u16 = 0x0001;
17181718
const FRH_DIRECTORY: u16 = 0x0002;
17191719

17201720
/// NTFS `FILE_NAME` namespace: Win32 (case-insensitive, visible in Explorer).
1721-
#[allow(dead_code)]
1721+
#[expect(
1722+
dead_code,
1723+
reason = "defined for completeness of NTFS namespace constants"
1724+
)]
17221725
const FILE_NAME_WIN32: u8 = 0x01;
17231726
/// NTFS `FILE_NAME` namespace: DOS-only (8.3 short name, not visible
17241727
/// standalone).
@@ -1728,7 +1731,10 @@ const FILE_NAME_WIN32: u8 = 0x01;
17281731
)]
17291732
const FILE_NAME_DOS: u8 = 0x02;
17301733
/// NTFS `FILE_NAME` namespace: Win32+DOS combined (visible in Explorer).
1731-
#[allow(dead_code)]
1734+
#[expect(
1735+
dead_code,
1736+
reason = "defined for completeness of NTFS namespace constants"
1737+
)]
17321738
const FILE_NAME_WIN32_DOS: u8 = 0x03;
17331739

17341740
/// FILE record magic number ('FILE' in little-endian = 'ELIF')
@@ -2317,8 +2323,8 @@ impl CppParsePipeline {
23172323
unsafe { core::ptr::read(attr_data[value_offset..].as_ptr().cast()) };
23182324

23192325
// C++ parity: skip only DOS-only (0x02) namespace.
2320-
// C++ code: `if (fn->Flags != 0x02 /*FILE_NAME_DOS */)` (ntfs_index.hpp line 550)
2321-
// Accepts POSIX (0x00), Win32 (0x01), and Win32+DOS (0x03).
2326+
// C++ code: `if (fn->Flags != 0x02 /*FILE_NAME_DOS */)` (ntfs_index.hpp line
2327+
// 550) Accepts POSIX (0x00), Win32 (0x01), and Win32+DOS (0x03).
23222328
let namespace = fn_attr.file_name_namespace;
23232329
if namespace == FILE_NAME_DOS {
23242330
return;
@@ -2344,7 +2350,8 @@ impl CppParsePipeline {
23442350
let record_idx = index.records_lookup[frs_base as usize] as usize;
23452351

23462352
// C++ parity: no deduplication. If record already has a name, push
2347-
// current first_name to overflow list (matches C++ ntfs_index.hpp lines 552-557).
2353+
// current first_name to overflow list (matches C++ ntfs_index.hpp lines
2354+
// 552-557).
23482355
let current_name_count = index.records_data[record_idx].name_count;
23492356
if current_name_count > 0 {
23502357
// Push current first_name to overflow list

crates/uffs-mft/src/index.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2280,8 +2280,8 @@ impl MftIndex {
22802280

22812281
tracing::debug!("[TRIP] MftIndex::compute_tree_metrics_cpp_port EXIT");
22822282
}
2283-
// NOTE: compute_tree_metrics_impl was removed - cpp_port is now the sole algorithm.
2284-
// See commit "refactor: remove algorithm selection machinery"
2283+
// NOTE: compute_tree_metrics_impl was removed - cpp_port is now the sole
2284+
// algorithm. See commit "refactor: remove algorithm selection machinery"
22852285

22862286
/// Display enhanced statistics to stdout.
22872287
///
@@ -5402,9 +5402,10 @@ mod tests {
54025402
"Directory should have descendants = 2"
54035403
);
54045404

5405-
// Root's size = children.length (Channel A from directory) + root's first_len (0)
5406-
// Channel A from directory = file_delta(1000) + internal_stream_delta(256) = 1256
5407-
// Root treesize (Channel B) = 1256 + 0 = 1256
5405+
// Root's size = children.length (Channel A from directory) + root's first_len
5406+
// (0) Channel A from directory = file_delta(1000) +
5407+
// internal_stream_delta(256) = 1256 Root treesize (Channel B) = 1256 +
5408+
// 0 = 1256
54085409
let root_idx = index.frs_to_idx_opt(root_frs).unwrap();
54095410
assert_eq!(
54105411
index.records[root_idx].treesize, 1256,

crates/uffs-mft/src/io.rs

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,14 @@ pub fn parse_record_to_index(data: &[u8], frs: u64, index: &mut crate::index::Mf
646646
};
647647
if is_better || primary_name.is_none() {
648648
// Move old primary to additional if exists
649-
if let Some((old_name, old_parent, _, old_parse_idx)) = primary_name.take() {
650-
additional_names.push((old_name, old_parent, old_parse_idx));
649+
if let Some((old_name, old_parent, _, old_parse_idx)) =
650+
primary_name.take()
651+
{
652+
additional_names.push((
653+
old_name,
654+
old_parent,
655+
old_parse_idx,
656+
));
651657
}
652658
primary_name = Some((name, parent_frs, namespace, parse_idx));
653659
} else {
@@ -667,9 +673,7 @@ pub fn parse_record_to_index(data: &[u8], frs: u64, index: &mut crate::index::Mf
667673
let nr_offset = offset + 16;
668674
if nr_offset + 8 <= data.len() {
669675
let lowest_vcn = i64::from_le_bytes(
670-
data[nr_offset..nr_offset + 8]
671-
.try_into()
672-
.unwrap_or([0; 8]),
676+
data[nr_offset..nr_offset + 8].try_into().unwrap_or([0; 8]),
673677
);
674678
lowest_vcn == 0
675679
} else {
@@ -835,7 +839,8 @@ pub fn parse_record_to_index(data: &[u8], frs: u64, index: &mut crate::index::Mf
835839
let additional_count = additional_names.len();
836840
let mut link_indices: Vec<u32> = Vec::with_capacity(additional_count);
837841
// Collect parent FRS values for building children array later
838-
let mut additional_parent_frs: SmallVec<[(u64, u16); 4]> = SmallVec::with_capacity(additional_count);
842+
let mut additional_parent_frs: SmallVec<[(u64, u16); 4]> =
843+
SmallVec::with_capacity(additional_count);
839844
for (link_name, link_parent, link_parse_idx) in additional_names {
840845
additional_parent_frs.push((link_parent, link_parse_idx));
841846
let link_offset = index.add_name(&link_name);
@@ -1083,9 +1088,7 @@ fn parse_extension_to_index(
10831088
let nr_offset = offset + 16;
10841089
if nr_offset + 8 <= data.len() {
10851090
let lowest_vcn = i64::from_le_bytes(
1086-
data[nr_offset..nr_offset + 8]
1087-
.try_into()
1088-
.unwrap_or([0; 8]),
1091+
data[nr_offset..nr_offset + 8].try_into().unwrap_or([0; 8]),
10891092
);
10901093
lowest_vcn == 0
10911094
} else {
@@ -1517,8 +1520,14 @@ pub fn parse_record_to_fragment(
15171520
_ => false,
15181521
};
15191522
if is_better || primary_name.is_none() {
1520-
if let Some((old_name, old_parent, _, old_parse_idx)) = primary_name.take() {
1521-
additional_names.push((old_name, old_parent, old_parse_idx));
1523+
if let Some((old_name, old_parent, _, old_parse_idx)) =
1524+
primary_name.take()
1525+
{
1526+
additional_names.push((
1527+
old_name,
1528+
old_parent,
1529+
old_parse_idx,
1530+
));
15221531
}
15231532
primary_name = Some((name, parent_frs, namespace, parse_idx));
15241533
} else {
@@ -1538,9 +1547,7 @@ pub fn parse_record_to_fragment(
15381547
let nr_offset = offset + 16;
15391548
if nr_offset + 8 <= data.len() {
15401549
let lowest_vcn = i64::from_le_bytes(
1541-
data[nr_offset..nr_offset + 8]
1542-
.try_into()
1543-
.unwrap_or([0; 8]),
1550+
data[nr_offset..nr_offset + 8].try_into().unwrap_or([0; 8]),
15441551
);
15451552
lowest_vcn == 0
15461553
} else {
@@ -1702,7 +1709,8 @@ pub fn parse_record_to_fragment(
17021709
let additional_count = additional_names.len();
17031710
let mut link_indices: Vec<u32> = Vec::with_capacity(additional_count);
17041711
// Collect parent FRS values for building children array later
1705-
let mut additional_parent_frs: SmallVec<[(u64, u16); 4]> = SmallVec::with_capacity(additional_count);
1712+
let mut additional_parent_frs: SmallVec<[(u64, u16); 4]> =
1713+
SmallVec::with_capacity(additional_count);
17061714
for (link_name, link_parent, link_parse_idx) in additional_names {
17071715
additional_parent_frs.push((link_parent, link_parse_idx));
17081716
let link_offset = fragment.add_name(&link_name);
@@ -2028,9 +2036,7 @@ fn parse_extension_to_fragment(
20282036
let nr_offset = offset + 16;
20292037
if nr_offset + 8 <= data.len() {
20302038
let lowest_vcn = i64::from_le_bytes(
2031-
data[nr_offset..nr_offset + 8]
2032-
.try_into()
2033-
.unwrap_or([0; 8]),
2039+
data[nr_offset..nr_offset + 8].try_into().unwrap_or([0; 8]),
20342040
);
20352041
lowest_vcn == 0
20362042
} else {
@@ -5348,8 +5354,10 @@ impl ParallelMftReader {
53485354
///
53495355
/// This method uses a producer-consumer pattern:
53505356
/// - IOCP thread reads data and sends buffers to a channel
5351-
/// - Worker threads parse buffers using `parse_record_full()` (unified pipeline)
5352-
/// - After all I/O completes, results are merged via `MftRecordMerger` into final index
5357+
/// - Worker threads parse buffers using `parse_record_full()` (unified
5358+
/// pipeline)
5359+
/// - After all I/O completes, results are merged via `MftRecordMerger` into
5360+
/// final index
53535361
///
53545362
/// This is beneficial for NVMe drives where I/O is faster than parsing.
53555363
/// For HDD, use `read_all_sliding_window_iocp_to_index` (inline parsing).

crates/uffs-mft/src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ use std::io;
4141
use std::path::{Path, PathBuf};
4242

4343
use anyhow::{Context, Result};
44+
use bitflags as _;
4445
use clap::{Parser, Subcommand};
4546
// Dev-dependencies (used in benchmarks and tests only)
4647
#[cfg(test)]
@@ -55,8 +56,11 @@ use indicatif as _;
5556
use indicatif::{ProgressBar, ProgressStyle};
5657
#[cfg(test)]
5758
use proptest as _;
59+
use rayon as _;
60+
use rustc_hash as _;
5861
// SmallVec for path chain building (used in index.rs PathResolver)
5962
use smallvec as _;
63+
use thiserror as _;
6064
#[cfg(not(windows))]
6165
use tracing as _;
6266
#[cfg(windows)]
@@ -71,10 +75,10 @@ use tracing_subscriber::{EnvFilter, Layer};
7175
use uffs_mft as _;
7276
#[cfg(windows)]
7377
use uffs_mft::MftReader;
78+
use uffs_polars as _;
7479
// Optional dependencies
7580
#[cfg(feature = "zstd")]
7681
use zstd as _;
77-
use {bitflags as _, rayon as _, rustc_hash as _, thiserror as _, uffs_polars as _};
7882
// Benchmark dependencies (used by bench/bench-all commands on Windows)
7983
#[cfg(not(windows))]
8084
use {chrono as _, hostname as _, num_cpus as _};

0 commit comments

Comments
 (0)