perf(tauri-build): refactor find_icon to use &str to remove unnecessary clones

This commit is contained in:
Tunglies 2026-01-30 10:29:37 +08:00
parent 32576120fd
commit 544e1ba099
No known key found for this signature in database
GPG Key ID: B9B01B389469B3E8
2 changed files with 9 additions and 4 deletions

View File

@ -0,0 +1,5 @@
---
"tauri-build": perf
---
Refactor find_icon to use &str to remove unnecessary clones. No user facing changes.

View File

@ -57,7 +57,7 @@ fn copy_binaries(
binaries: ResourcePaths,
target_triple: &str,
path: &Path,
package_name: Option<&String>,
package_name: Option<&str>,
) -> Result<()> {
for src in binaries {
let src = src?;
@ -529,7 +529,7 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
ResourcePaths::new(&external_binaries(paths, &target_triple, &target), true),
&target_triple,
target_dir,
manifest.package.as_ref().map(|p| &p.name),
manifest.package.as_ref().map(|p| p.name.as_ref()),
)?;
}
@ -593,8 +593,8 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
.icon
.iter()
.find(|i| predicate(i))
.cloned()
.unwrap_or_else(|| default.to_string());
.map(AsRef::as_ref)
.unwrap_or_else(|| default);
icon_path.into()
}