Skip to content

Commit ce98d87

Browse files
TungliesFabianLars
andauthored
refactor: remove needless collect (#14474)
Co-authored-by: Fabian-Lars <github@fabianlars.de>
1 parent ad1dec2 commit ce98d87

4 files changed

Lines changed: 20 additions & 17 deletions

File tree

.changes/fix-needles-collect.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"tauri": patch:perf
3+
"tauri-cli": patch:perf
4+
"tauri-bundler": patch:perf
5+
"@tauri-apps/cli": patch:perf
6+
---
7+
8+
refactor: remove needless collect. No user facing changes.

crates/tauri-bundler/src/bundle.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,10 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<Bundle>> {
241241
return Ok(bundles);
242242
}
243243

244-
let bundles_wo_updater = bundles
244+
let finished_bundles = bundles
245245
.iter()
246246
.filter(|b| b.package_type != PackageType::Updater)
247-
.collect::<Vec<_>>();
248-
let finished_bundles = bundles_wo_updater.len();
247+
.count();
249248
let pluralised = if finished_bundles == 1 {
250249
"bundle"
251250
} else {

crates/tauri-cli/src/icon.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -280,19 +280,15 @@ pub fn command(options: Options) -> Result<()> {
280280
android(&source, &input, manifest, &bg_color_string, &out_dir)
281281
.context("Failed to generate android icons")?;
282282
} else {
283-
for target in png_icon_sizes
284-
.into_iter()
285-
.map(|size| {
286-
let name = format!("{size}x{size}.png");
287-
let out_path = out_dir.join(&name);
288-
PngEntry {
289-
name,
290-
out_path,
291-
size,
292-
}
293-
})
294-
.collect::<Vec<PngEntry>>()
295-
{
283+
for target in png_icon_sizes.into_iter().map(|size| {
284+
let name = format!("{size}x{size}.png");
285+
let out_path = out_dir.join(&name);
286+
PngEntry {
287+
name,
288+
out_path,
289+
size,
290+
}
291+
}) {
296292
log::info!(action = "PNG"; "Creating {}", target.name);
297293
resize_and_save_png(&source, target.size, &target.out_path, None, None)?;
298294
}

crates/tauri/src/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ fn restart_macos_app(current_binary: &std::path::Path, env: &Env) {
116116
.and_then(|v| v.as_string())
117117
{
118118
if let Err(e) = Command::new(macos_directory.join(binary_name))
119-
.args(env.args_os.iter().skip(1).collect::<Vec<_>>())
119+
.args(env.args_os.iter().skip(1))
120120
.spawn()
121121
{
122122
log::error!("failed to restart app: {e}");

0 commit comments

Comments
 (0)