Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Commit b3a1ea8

Browse files
authored
Do not stop on missing globs, handle them as non-matches (#107)
1 parent d92dd9f commit b3a1ea8

File tree

1 file changed

+6
-12
lines changed
  • wasm-rpc-stubgen/src/commands

1 file changed

+6
-12
lines changed

wasm-rpc-stubgen/src/commands/app.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,14 +1286,13 @@ where
12861286
}
12871287

12881288
fn compile_and_collect_globs(root_dir: &Path, globs: &[String]) -> Result<Vec<PathBuf>, Error> {
1289-
globs
1289+
Ok(globs
12901290
.iter()
12911291
.map(|pattern| {
12921292
Glob::new(pattern)
1293-
.with_context(|| format!("Failed to compile glob expression: {}", pattern))
1293+
.with_context(|| anyhow!("Failed to compile glob expression: {}", pattern))
12941294
})
1295-
.collect::<Result<Vec<_>, _>>()
1296-
.map_err(|err| anyhow!(err))?
1295+
.collect::<Result<Vec<_>, _>>()?
12971296
.iter()
12981297
.flat_map(|glob| {
12991298
glob.walk_with_behavior(
@@ -1303,15 +1302,10 @@ fn compile_and_collect_globs(root_dir: &Path, globs: &[String]) -> Result<Vec<Pa
13031302
..WalkBehavior::default()
13041303
},
13051304
)
1306-
.collect::<Vec<_>>()
1305+
.filter_map(|entry| entry.ok())
1306+
.map(|walk_item| walk_item.path().to_path_buf())
13071307
})
1308-
.map(|walk_item| {
1309-
walk_item
1310-
.map(|entry| entry.path().to_path_buf())
1311-
.with_context(|| "Failed to get path from item when evaluating glob expressions")
1312-
})
1313-
.collect::<Result<Vec<_>, _>>()
1314-
.map_err(|err| anyhow!(err))
1308+
.collect::<Vec<_>>())
13151309
}
13161310

13171311
fn create_generated_base_wit<CPE: ComponentPropertiesExtensions>(

0 commit comments

Comments
 (0)