@@ -26,7 +26,7 @@ use wax::{Glob, walk::Entry as _};
2626/// * `negative_globs` - Glob patterns that should exclude files from the result
2727///
2828/// # Returns
29- /// A sorted map of relative paths (from workspace_root) to their content hashes.
29+ /// A sorted map of relative paths (from ` workspace_root` ) to their content hashes.
3030/// Only files are included (directories are skipped).
3131///
3232/// # Example
@@ -40,6 +40,10 @@ use wax::{Glob, walk::Entry as _};
4040/// )?;
4141/// // Returns: { "packages/foo/src/index.ts" => 0x1234..., ... }
4242/// ```
43+ #[ expect(
44+ clippy:: disallowed_methods,
45+ reason = "str::replace needed for path normalization; cow_replace unavailable in this crate"
46+ ) ]
4347pub fn compute_globbed_inputs (
4448 base_dir : & AbsolutePath ,
4549 workspace_root : & AbsolutePath ,
@@ -65,9 +69,8 @@ pub fn compute_globbed_inputs(
6569 for pattern in positive_globs {
6670 let glob = Glob :: new ( pattern. as_str ( ) ) ?;
6771 for entry in glob. walk ( base_dir. as_path ( ) ) {
68- let entry = match entry {
69- Ok ( e) => e,
70- Err ( _) => continue ,
72+ let Ok ( entry) = entry else {
73+ continue ;
7174 } ;
7275
7376 // Skip non-files
@@ -78,11 +81,9 @@ pub fn compute_globbed_inputs(
7881 let absolute_path = entry. path ( ) ;
7982
8083 // Compute path relative to base_dir for negative pattern matching
81- let relative_to_base: & std:: path:: Path =
82- match absolute_path. strip_prefix ( base_dir. as_path ( ) ) {
83- Ok ( rel) => rel,
84- Err ( _) => continue , // Skip if path is outside base_dir
85- } ;
84+ let Ok ( relative_to_base) = absolute_path. strip_prefix ( base_dir. as_path ( ) ) else {
85+ continue ; // Skip if path is outside base_dir
86+ } ;
8687
8788 // Apply negative patterns (relative to base_dir)
8889 if let Some ( ref matcher) = negative_matcher {
@@ -98,7 +99,7 @@ pub fn compute_globbed_inputs(
9899 let Some ( relative_to_workspace) = absolute_path
99100 . strip_prefix ( workspace_root. as_path ( ) )
100101 . ok ( )
101- . and_then ( |p : & std :: path :: Path | RelativePathBuf :: new ( p. to_path_buf ( ) ) . ok ( ) )
102+ . and_then ( |p| RelativePathBuf :: new ( p) . ok ( ) )
102103 else {
103104 continue ; // Skip if path is outside workspace_root
104105 } ;
@@ -110,7 +111,6 @@ pub fn compute_globbed_inputs(
110111 }
111112 Err ( err) if err. kind ( ) == io:: ErrorKind :: NotFound => {
112113 // File was deleted between walk and hash, skip it
113- continue ;
114114 }
115115 Err ( err) => {
116116 return Err ( err. into ( ) ) ;
@@ -122,7 +122,8 @@ pub fn compute_globbed_inputs(
122122 Ok ( result)
123123}
124124
125- /// Hash file content using xxHash3_64
125+ /// Hash file content using `xxHash3_64`.
126+ #[ expect( clippy:: disallowed_types, reason = "receives std::path::Path from wax glob walker" ) ]
126127fn hash_file_content ( path : & std:: path:: Path ) -> io:: Result < u64 > {
127128 let file = File :: open ( path) ?;
128129 let mut reader = io:: BufReader :: new ( file) ;
@@ -187,7 +188,7 @@ mod tests {
187188 fn test_single_positive_glob ( ) {
188189 let ( _temp, workspace, package) = create_test_workspace ( ) ;
189190 let positive: std:: collections:: BTreeSet < Str > =
190- [ "src/**/*.ts" . into ( ) ] . into_iter ( ) . collect ( ) ;
191+ std :: iter :: once ( "src/**/*.ts" . into ( ) ) . collect ( ) ;
191192 let negative = std:: collections:: BTreeSet :: new ( ) ;
192193
193194 let result = compute_globbed_inputs ( & package, & workspace, & positive, & negative) . unwrap ( ) ;
@@ -217,9 +218,9 @@ mod tests {
217218 fn test_positive_with_negative_exclusion ( ) {
218219 let ( _temp, workspace, package) = create_test_workspace ( ) ;
219220 let positive: std:: collections:: BTreeSet < Str > =
220- [ "src/**/*.ts" . into ( ) ] . into_iter ( ) . collect ( ) ;
221+ std :: iter :: once ( "src/**/*.ts" . into ( ) ) . collect ( ) ;
221222 let negative: std:: collections:: BTreeSet < Str > =
222- [ "**/*.test.ts" . into ( ) ] . into_iter ( ) . collect ( ) ;
223+ std :: iter :: once ( "**/*.test.ts" . into ( ) ) . collect ( ) ;
223224
224225 let result = compute_globbed_inputs ( & package, & workspace, & positive, & negative) . unwrap ( ) ;
225226
@@ -251,7 +252,7 @@ mod tests {
251252 let positive: std:: collections:: BTreeSet < Str > =
252253 [ "src/**/*.ts" . into ( ) , "package.json" . into ( ) ] . into_iter ( ) . collect ( ) ;
253254 let negative: std:: collections:: BTreeSet < Str > =
254- [ "**/*.test.ts" . into ( ) ] . into_iter ( ) . collect ( ) ;
255+ std :: iter :: once ( "**/*.test.ts" . into ( ) ) . collect ( ) ;
255256
256257 let result = compute_globbed_inputs ( & package, & workspace, & positive, & negative) . unwrap ( ) ;
257258
@@ -302,7 +303,7 @@ mod tests {
302303 let ( _temp, workspace, package) = create_test_workspace ( ) ;
303304 let positive: std:: collections:: BTreeSet < Str > = std:: collections:: BTreeSet :: new ( ) ;
304305 let negative: std:: collections:: BTreeSet < Str > =
305- [ "**/*.test.ts" . into ( ) ] . into_iter ( ) . collect ( ) ;
306+ std :: iter :: once ( "**/*.test.ts" . into ( ) ) . collect ( ) ;
306307
307308 let result = compute_globbed_inputs ( & package, & workspace, & positive, & negative) . unwrap ( ) ;
308309
@@ -314,7 +315,7 @@ mod tests {
314315 fn test_file_hashes_are_consistent ( ) {
315316 let ( _temp, workspace, package) = create_test_workspace ( ) ;
316317 let positive: std:: collections:: BTreeSet < Str > =
317- [ "src/index.ts" . into ( ) ] . into_iter ( ) . collect ( ) ;
318+ std :: iter :: once ( "src/index.ts" . into ( ) ) . collect ( ) ;
318319 let negative = std:: collections:: BTreeSet :: new ( ) ;
319320
320321 // Run twice and compare hashes
@@ -328,7 +329,7 @@ mod tests {
328329 fn test_file_hashes_change_with_content ( ) {
329330 let ( temp, workspace, package) = create_test_workspace ( ) ;
330331 let positive: std:: collections:: BTreeSet < Str > =
331- [ "src/index.ts" . into ( ) ] . into_iter ( ) . collect ( ) ;
332+ std :: iter :: once ( "src/index.ts" . into ( ) ) . collect ( ) ;
332333 let negative = std:: collections:: BTreeSet :: new ( ) ;
333334
334335 // Get initial hash
@@ -352,7 +353,7 @@ mod tests {
352353 fn test_skips_directories ( ) {
353354 let ( _temp, workspace, package) = create_test_workspace ( ) ;
354355 // This glob could match the `src/lib` directory if not filtered
355- let positive: std:: collections:: BTreeSet < Str > = [ "src/*" . into ( ) ] . into_iter ( ) . collect ( ) ;
356+ let positive: std:: collections:: BTreeSet < Str > = std :: iter :: once ( "src/*" . into ( ) ) . collect ( ) ;
356357 let negative = std:: collections:: BTreeSet :: new ( ) ;
357358
358359 let result = compute_globbed_inputs ( & package, & workspace, & positive, & negative) . unwrap ( ) ;
@@ -368,7 +369,7 @@ mod tests {
368369 fn test_no_matching_files_returns_empty ( ) {
369370 let ( _temp, workspace, package) = create_test_workspace ( ) ;
370371 let positive: std:: collections:: BTreeSet < Str > =
371- [ "nonexistent/**/*.xyz" . into ( ) ] . into_iter ( ) . collect ( ) ;
372+ std :: iter :: once ( "nonexistent/**/*.xyz" . into ( ) ) . collect ( ) ;
372373 let negative = std:: collections:: BTreeSet :: new ( ) ;
373374
374375 let result = compute_globbed_inputs ( & package, & workspace, & positive, & negative) . unwrap ( ) ;
@@ -382,7 +383,7 @@ mod tests {
382383 let positive: std:: collections:: BTreeSet < Str > =
383384 [ "src/**/*.ts" . into ( ) , "src/index.ts" . into ( ) ] . into_iter ( ) . collect ( ) ;
384385 let negative: std:: collections:: BTreeSet < Str > =
385- [ "**/*.test.ts" . into ( ) ] . into_iter ( ) . collect ( ) ;
386+ std :: iter :: once ( "**/*.test.ts" . into ( ) ) . collect ( ) ;
386387
387388 let result = compute_globbed_inputs ( & package, & workspace, & positive, & negative) . unwrap ( ) ;
388389
0 commit comments