Skip to content

Commit a425b5f

Browse files
committed
Use map instead of mut Vec
1 parent 81def41 commit a425b5f

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

plugins/fs/src/watcher.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,18 @@ pub fn watch<R: Runtime>(
4545
global_scope: GlobalScope<Entry>,
4646
command_scope: CommandScope<Entry>,
4747
) -> CommandResult<ResourceId> {
48-
let mut resolved_paths = Vec::with_capacity(paths.capacity());
49-
for path in paths {
50-
resolved_paths.push(resolve_path(
51-
&webview,
52-
&global_scope,
53-
&command_scope,
54-
path,
55-
options.base_dir,
56-
)?);
57-
}
48+
let resolved_paths = paths
49+
.into_iter()
50+
.map(|path| {
51+
resolve_path(
52+
&webview,
53+
&global_scope,
54+
&command_scope,
55+
path,
56+
options.base_dir,
57+
)
58+
})
59+
.collect::<CommandResult<Vec<_>>>()?;
5860

5961
let recursive_mode = if options.recursive {
6062
RecursiveMode::Recursive

0 commit comments

Comments
 (0)