Skip to content

Commit b3038b5

Browse files
FabianLarss00d
authored andcommitted
chore: clippy 1.88 (#13720)
1 parent 9a2d1d0 commit b3038b5

File tree

36 files changed

+90
-113
lines changed

36 files changed

+90
-113
lines changed

bench/src/build_benchmark_jsons.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ fn main() {
5252
.expect("Something wrong with tauri_data"),
5353
&serde_json::to_value(all_data).expect("Unable to build final json (all)"),
5454
)
55-
.unwrap_or_else(|_| panic!("Unable to write {:?}", tauri_data));
55+
.unwrap_or_else(|_| panic!("Unable to write {tauri_data:?}"));
5656

5757
utils::write_json(
5858
tauri_recent
5959
.to_str()
6060
.expect("Something wrong with tauri_recent"),
6161
&serde_json::to_value(recent).expect("Unable to build final json (recent)"),
6262
)
63-
.unwrap_or_else(|_| panic!("Unable to write {:?}", tauri_recent));
63+
.unwrap_or_else(|_| panic!("Unable to write {tauri_recent:?}"));
6464
}

bench/src/run_benchmark.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fn run_max_mem_benchmark() -> Result<HashMap<String, u64>> {
8989
let mut results = HashMap::<String, u64>::new();
9090

9191
for (name, example_exe) in get_all_benchmarks() {
92-
let benchmark_file = utils::target_dir().join(format!("mprof{}_.dat", name));
92+
let benchmark_file = utils::target_dir().join(format!("mprof{name}_.dat"));
9393
let benchmark_file = benchmark_file.to_str().unwrap();
9494

9595
let proc = Command::new("mprof")
@@ -105,7 +105,7 @@ fn run_max_mem_benchmark() -> Result<HashMap<String, u64>> {
105105
.spawn()?;
106106

107107
let proc_result = proc.wait_with_output()?;
108-
println!("{:?}", proc_result);
108+
println!("{proc_result:?}");
109109
results.insert(
110110
name.to_string(),
111111
utils::parse_max_mem(benchmark_file).unwrap(),
@@ -126,11 +126,11 @@ fn rlib_size(target_dir: &std::path::Path, prefix: &str) -> u64 {
126126
if name.starts_with(prefix) && name.ends_with(".rlib") {
127127
let start = name.split('-').next().unwrap().to_string();
128128
if seen.contains(&start) {
129-
println!("skip {}", name);
129+
println!("skip {name}");
130130
} else {
131131
seen.insert(start);
132132
size += entry.metadata().unwrap().len();
133-
println!("check size {} {}", name, size);
133+
println!("check size {name} {size}");
134134
}
135135
}
136136
}
@@ -142,7 +142,7 @@ fn get_binary_sizes(target_dir: &Path) -> Result<HashMap<String, u64>> {
142142
let mut sizes = HashMap::<String, u64>::new();
143143

144144
let wry_size = rlib_size(target_dir, "libwry");
145-
println!("wry {} bytes", wry_size);
145+
println!("wry {wry_size} bytes");
146146
sizes.insert("wry_rlib".to_string(), wry_size);
147147

148148
// add size for all EXEC_TIME_BENCHMARKS

bench/src/utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ pub fn run_collect(cmd: &[&str]) -> (String, String) {
9696
let stdout = String::from_utf8_lossy(&stdout).to_string();
9797
let stderr = String::from_utf8_lossy(&stderr).to_string();
9898
if !status.success() {
99-
eprintln!("stdout: <<<{}>>>", stdout);
100-
eprintln!("stderr: <<<{}>>>", stderr);
99+
eprintln!("stdout: <<<{stdout}>>>");
100+
eprintln!("stderr: <<<{stderr}>>>");
101101
panic!("Unexpected exit code: {:?}", status.code());
102102
}
103103
(stdout, stderr)
@@ -230,7 +230,7 @@ pub fn download_file(url: &str, filename: PathBuf) {
230230

231231
// Downloading with curl this saves us from adding
232232
// a Rust HTTP client dependency.
233-
println!("Downloading {}", url);
233+
println!("Downloading {url}");
234234
let status = Command::new("curl")
235235
.arg("-L")
236236
.arg("-s")

crates/tauri-bundler/src/bundle/linux/appimage.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
2727
Arch::Armhf => "armhf",
2828
target => {
2929
return Err(crate::Error::ArchError(format!(
30-
"Unsupported architecture: {:?}",
31-
target
30+
"Unsupported architecture: {target:?}"
3231
)));
3332
}
3433
};

crates/tauri-bundler/src/bundle/linux/debian.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
4949
Arch::Riscv64 => "riscv64",
5050
target => {
5151
return Err(crate::Error::ArchError(format!(
52-
"Unsupported architecture: {:?}",
53-
target
52+
"Unsupported architecture: {target:?}"
5453
)));
5554
}
5655
};
@@ -164,7 +163,7 @@ fn generate_control_file(
164163
let dest_path = control_dir.join("control");
165164
let mut file = fs_utils::create_file(&dest_path)?;
166165
let package = heck::AsKebabCase(settings.product_name());
167-
writeln!(file, "Package: {}", package)?;
166+
writeln!(file, "Package: {package}")?;
168167
writeln!(file, "Version: {}", settings.version_string())?;
169168
writeln!(file, "Architecture: {arch}")?;
170169
// Installed-Size must be divided by 1024, see https://www.debian.org/doc/debian-policy/ch-controlfields.html#installed-size
@@ -183,16 +182,16 @@ fn generate_control_file(
183182

184183
writeln!(file, "Maintainer: {authors}")?;
185184
if let Some(section) = &settings.deb().section {
186-
writeln!(file, "Section: {}", section)?;
185+
writeln!(file, "Section: {section}")?;
187186
}
188187
if let Some(priority) = &settings.deb().priority {
189-
writeln!(file, "Priority: {}", priority)?;
188+
writeln!(file, "Priority: {priority}")?;
190189
} else {
191190
writeln!(file, "Priority: optional")?;
192191
}
193192

194193
if let Some(homepage) = settings.homepage_url() {
195-
writeln!(file, "Homepage: {}", homepage)?;
194+
writeln!(file, "Homepage: {homepage}")?;
196195
}
197196

198197
let dependencies = settings.deb().depends.as_ref().cloned().unwrap_or_default();

crates/tauri-bundler/src/bundle/linux/rpm.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
3232
Arch::Riscv64 => "riscv64",
3333
target => {
3434
return Err(crate::Error::ArchError(format!(
35-
"Unsupported architecture: {:?}",
36-
target
35+
"Unsupported architecture: {target:?}"
3736
)));
3837
}
3938
};

crates/tauri-bundler/src/bundle/macos/app.rs

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,11 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
6565

6666
if app_bundle_path.exists() {
6767
fs::remove_dir_all(&app_bundle_path)
68-
.with_context(|| format!("Failed to remove old {}", app_product_name))?;
68+
.with_context(|| format!("Failed to remove old {app_product_name}"))?;
6969
}
7070
let bundle_directory = app_bundle_path.join("Contents");
71-
fs::create_dir_all(&bundle_directory).with_context(|| {
72-
format!(
73-
"Failed to create bundle directory at {:?}",
74-
bundle_directory
75-
)
76-
})?;
71+
fs::create_dir_all(&bundle_directory)
72+
.with_context(|| format!("Failed to create bundle directory at {bundle_directory:?}"))?;
7773

7874
let resources_dir = bundle_directory.join("Resources");
7975
let bin_dir = bundle_directory.join("MacOS");
@@ -160,7 +156,7 @@ fn copy_binaries_to_bundle(
160156
let bin_path = settings.binary_path(bin);
161157
let dest_path = dest_dir.join(bin.name());
162158
fs_utils::copy_file(&bin_path, &dest_path)
163-
.with_context(|| format!("Failed to copy binary from {:?}", bin_path))?;
159+
.with_context(|| format!("Failed to copy binary from {bin_path:?}"))?;
164160
paths.push(dest_path);
165161
}
166162
Ok(paths)
@@ -176,10 +172,10 @@ fn copy_custom_files_to_bundle(bundle_directory: &Path, settings: &Settings) ->
176172
};
177173
if path.is_file() {
178174
fs_utils::copy_file(path, &bundle_directory.join(contents_path))
179-
.with_context(|| format!("Failed to copy file {:?} to {:?}", path, contents_path))?;
175+
.with_context(|| format!("Failed to copy file {path:?} to {contents_path:?}"))?;
180176
} else {
181177
fs_utils::copy_dir(path, &bundle_directory.join(contents_path))
182-
.with_context(|| format!("Failed to copy directory {:?} to {:?}", path, contents_path))?;
178+
.with_context(|| format!("Failed to copy directory {path:?} to {contents_path:?}"))?;
183179
}
184180
}
185181
Ok(())
@@ -359,7 +355,7 @@ fn create_info_plist(
359355

360356
// Copies the framework under `{src_dir}/{framework}.framework` to `{dest_dir}/{framework}.framework`.
361357
fn copy_framework_from(dest_dir: &Path, framework: &str, src_dir: &Path) -> crate::Result<bool> {
362-
let src_name = format!("{}.framework", framework);
358+
let src_name = format!("{framework}.framework");
363359
let src_path = src_dir.join(&src_name);
364360
if src_path.exists() {
365361
fs_utils::copy_dir(&src_path, &dest_dir.join(&src_name))?;
@@ -387,7 +383,7 @@ fn copy_frameworks_to_bundle(
387383
}
388384
let dest_dir = bundle_directory.join("Frameworks");
389385
fs::create_dir_all(bundle_directory)
390-
.with_context(|| format!("Failed to create Frameworks directory at {:?}", dest_dir))?;
386+
.with_context(|| format!("Failed to create Frameworks directory at {dest_dir:?}"))?;
391387
for framework in frameworks.iter() {
392388
if framework.ends_with(".framework") {
393389
let src_path = PathBuf::from(framework);
@@ -402,8 +398,7 @@ fn copy_frameworks_to_bundle(
402398
let src_path = PathBuf::from(framework);
403399
if !src_path.exists() {
404400
return Err(crate::Error::GenericError(format!(
405-
"Library not found: {}",
406-
framework
401+
"Library not found: {framework}"
407402
)));
408403
}
409404
let src_name = src_path.file_name().expect("Couldn't get library filename");
@@ -416,8 +411,7 @@ fn copy_frameworks_to_bundle(
416411
continue;
417412
} else if framework.contains('/') {
418413
return Err(crate::Error::GenericError(format!(
419-
"Framework path should have .framework extension: {}",
420-
framework
414+
"Framework path should have .framework extension: {framework}"
421415
)));
422416
}
423417
if let Some(home_dir) = dirs::home_dir() {
@@ -435,8 +429,7 @@ fn copy_frameworks_to_bundle(
435429
continue;
436430
}
437431
return Err(crate::Error::GenericError(format!(
438-
"Could not locate framework: {}",
439-
framework
432+
"Could not locate framework: {framework}"
440433
)));
441434
}
442435
Ok(paths)

crates/tauri-bundler/src/bundle/macos/dmg/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ pub fn bundle_project(settings: &Settings, bundles: &[Bundle]) -> crate::Result<
4949
Arch::Universal => "universal",
5050
target => {
5151
return Err(crate::Error::ArchError(format!(
52-
"Unsupported architecture: {:?}",
53-
target
52+
"Unsupported architecture: {target:?}"
5453
)));
5554
}
5655
}
@@ -59,7 +58,7 @@ pub fn bundle_project(settings: &Settings, bundles: &[Bundle]) -> crate::Result<
5958
let dmg_path = output_path.join(&dmg_name);
6059

6160
let product_name = settings.product_name();
62-
let bundle_file_name = format!("{}.app", product_name);
61+
let bundle_file_name = format!("{product_name}.app");
6362
let bundle_dir = settings.project_out_directory().join("bundle/macos");
6463

6564
let support_directory_path = output_path
@@ -69,10 +68,10 @@ pub fn bundle_project(settings: &Settings, bundles: &[Bundle]) -> crate::Result<
6968

7069
for path in &[&support_directory_path, &output_path] {
7170
if path.exists() {
72-
fs::remove_dir_all(path).with_context(|| format!("Failed to remove old {}", dmg_name))?;
71+
fs::remove_dir_all(path).with_context(|| format!("Failed to remove old {dmg_name}"))?;
7372
}
7473
fs::create_dir_all(path)
75-
.with_context(|| format!("Failed to create output directory at {:?}", path))?;
74+
.with_context(|| format!("Failed to create output directory at {path:?}"))?;
7675
}
7776

7877
// create paths for script

crates/tauri-bundler/src/bundle/macos/ios.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
4545

4646
if app_bundle_path.exists() {
4747
fs::remove_dir_all(&app_bundle_path)
48-
.with_context(|| format!("Failed to remove old {}", app_product_name))?;
48+
.with_context(|| format!("Failed to remove old {app_product_name}"))?;
4949
}
5050
fs::create_dir_all(&app_bundle_path)
51-
.with_context(|| format!("Failed to create bundle directory at {:?}", app_bundle_path))?;
51+
.with_context(|| format!("Failed to create bundle directory at {app_bundle_path:?}"))?;
5252

5353
for src in settings.resource_files() {
5454
let src = src?;
5555
let dest = app_bundle_path.join(tauri_utils::resources::resource_relpath(&src));
5656
fs_utils::copy_file(&src, &dest)
57-
.with_context(|| format!("Failed to copy resource file {:?}", src))?;
57+
.with_context(|| format!("Failed to copy resource file {src:?}"))?;
5858
}
5959

6060
let icon_filenames = generate_icon_files(&app_bundle_path, settings)
@@ -65,7 +65,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
6565
for bin in settings.binaries() {
6666
let bin_path = settings.binary_path(bin);
6767
fs_utils::copy_file(&bin_path, &app_bundle_path.join(bin.name()))
68-
.with_context(|| format!("Failed to copy binary from {:?}", bin_path))?;
68+
.with_context(|| format!("Failed to copy binary from {bin_path:?}"))?;
6969
}
7070

7171
Ok(vec![app_bundle_path])
@@ -197,7 +197,7 @@ fn generate_info_plist(
197197
if !icon_filenames.is_empty() {
198198
writeln!(file, " <key>CFBundleIconFiles</key>\n <array>")?;
199199
for filename in icon_filenames {
200-
writeln!(file, " <string>{}</string>", filename)?;
200+
writeln!(file, " <string>{filename}</string>")?;
201201
}
202202
writeln!(file, " </array>")?;
203203
}

crates/tauri-bundler/src/bundle/windows/msi/mod.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ impl ResourceDirectory {
177177
directories.push_str(wix_string.as_str());
178178
}
179179
let wix_string = if self.name.is_empty() {
180-
format!("{}{}", files, directories)
180+
format!("{files}{directories}")
181181
} else {
182182
format!(
183183
r#"<Directory Id="I{id}" Name="{name}">{files}{directories}</Directory>"#,
@@ -221,8 +221,7 @@ fn app_installer_output_path(
221221
Arch::AArch64 => "arm64",
222222
target => {
223223
return Err(crate::Error::ArchError(format!(
224-
"Unsupported architecture: {:?}",
225-
target
224+
"Unsupported architecture: {target:?}"
226225
)))
227226
}
228227
};
@@ -352,8 +351,7 @@ fn run_candle(
352351
Arch::AArch64 => "arm64",
353352
target => {
354353
return Err(crate::Error::ArchError(format!(
355-
"unsupported architecture: {:?}",
356-
target
354+
"unsupported architecture: {target:?}"
357355
)))
358356
}
359357
};
@@ -443,8 +441,7 @@ pub fn build_wix_app_installer(
443441
Arch::AArch64 => "arm64",
444442
target => {
445443
return Err(crate::Error::ArchError(format!(
446-
"unsupported architecture: {:?}",
447-
target
444+
"unsupported architecture: {target:?}"
448445
)))
449446
}
450447
};
@@ -845,7 +842,7 @@ pub fn build_wix_app_installer(
845842

846843
let locale_contents = locale_contents.replace(
847844
"</WixLocalization>",
848-
&format!("{}</WixLocalization>", unset_locale_strings),
845+
&format!("{unset_locale_strings}</WixLocalization>"),
849846
);
850847
let locale_path = output_path.join("locale.wxl");
851848
{

0 commit comments

Comments
 (0)