Use map instead of mut Vec

pull/2613/head
Tony 3 months ago
parent 81def417cd
commit a425b5f625
No known key found for this signature in database
GPG Key ID: 34BDD3EA27824956

@ -45,16 +45,18 @@ pub fn watch<R: Runtime>(
global_scope: GlobalScope<Entry>, global_scope: GlobalScope<Entry>,
command_scope: CommandScope<Entry>, command_scope: CommandScope<Entry>,
) -> CommandResult<ResourceId> { ) -> CommandResult<ResourceId> {
let mut resolved_paths = Vec::with_capacity(paths.capacity()); let resolved_paths = paths
for path in paths { .into_iter()
resolved_paths.push(resolve_path( .map(|path| {
&webview, resolve_path(
&global_scope, &webview,
&command_scope, &global_scope,
path, &command_scope,
options.base_dir, path,
)?); options.base_dir,
} )
})
.collect::<CommandResult<Vec<_>>>()?;
let recursive_mode = if options.recursive { let recursive_mode = if options.recursive {
RecursiveMode::Recursive RecursiveMode::Recursive

Loading…
Cancel
Save