diff --git a/core/tauri-build/src/lib.rs b/core/tauri-build/src/lib.rs index 961f54f575eb..e7684e0dbb59 100644 --- a/core/tauri-build/src/lib.rs +++ b/core/tauri-build/src/lib.rs @@ -156,7 +156,7 @@ fn copy_dir(from: &Path, to: &Path) -> Result<()> { // Copies the framework under `{src_dir}/{framework}.framework` to `{dest_dir}/{framework}.framework`. fn copy_framework_from(src_dir: &Path, framework: &str, dest_dir: &Path) -> Result { - let src_name = format!("{}.framework", framework); + let src_name = format!("{framework}.framework"); let src_path = src_dir.join(&src_name); if src_path.exists() { copy_dir(&src_path, &dest_dir.join(&src_name))?; @@ -168,12 +168,8 @@ fn copy_framework_from(src_dir: &Path, framework: &str, dest_dir: &Path) -> Resu // Copies the macOS application bundle frameworks to the target folder fn copy_frameworks(dest_dir: &Path, frameworks: &[String]) -> Result<()> { - std::fs::create_dir_all(dest_dir).with_context(|| { - format!( - "Failed to create frameworks output directory at {:?}", - dest_dir - ) - })?; + std::fs::create_dir_all(dest_dir) + .with_context(|| format!("Failed to create frameworks output directory at {dest_dir:?}"))?; for framework in frameworks.iter() { if framework.ends_with(".framework") { let src_path = PathBuf::from(framework); @@ -469,7 +465,7 @@ pub fn try_build(attributes: Attributes) -> Result<()> { let mut android_package_prefix = String::new(); for (i, w) in s.enumerate() { if i == last { - println!("cargo:rustc-env=TAURI_ANDROID_PACKAGE_NAME_APP_NAME={}", w); + println!("cargo:rustc-env=TAURI_ANDROID_PACKAGE_NAME_APP_NAME={w}"); } else { android_package_prefix.push_str(w); android_package_prefix.push('_'); diff --git a/core/tauri-build/src/mobile.rs b/core/tauri-build/src/mobile.rs index 548de42b79c8..3c8e7c1cb797 100644 --- a/core/tauri-build/src/mobile.rs +++ b/core/tauri-build/src/mobile.rs @@ -55,9 +55,9 @@ dependencies {" app_build_gradle.push_str("\n}"); if let Some(version) = config.version.as_ref() { - app_tauri_properties.push(format!("tauri.android.versionName={}", version)); + app_tauri_properties.push(format!("tauri.android.versionName={version}")); if let Some(version_code) = config.bundle.android.version_code.as_ref() { - app_tauri_properties.push(format!("tauri.android.versionCode={}", version_code)); + app_tauri_properties.push(format!("tauri.android.versionCode={version_code}")); } else if let Ok(version) = Version::parse(version) { let mut version_code = version.major * 1000000 + version.minor * 1000 + version.patch; @@ -76,7 +76,7 @@ dependencies {" )); } - app_tauri_properties.push(format!("tauri.android.versionCode={}", version_code)); + app_tauri_properties.push(format!("tauri.android.versionCode={version_code}")); } } diff --git a/core/tauri-codegen/src/context.rs b/core/tauri-codegen/src/context.rs index f49d9356ae32..55b00692b778 100644 --- a/core/tauri-codegen/src/context.rs +++ b/core/tauri-codegen/src/context.rs @@ -183,8 +183,7 @@ pub fn context_codegen(data: ContextData) -> EmbeddedAssetsResult { let assets_path = config_parent.join(path); if !assets_path.exists() { panic!( - "The `frontendDist` configuration is set to `{:?}` but this path doesn't exist", - path + "The `frontendDist` configuration is set to `{path:?}` but this path doesn't exist" ) } EmbeddedAssets::new(assets_path, &options, map_core_assets(&options))? diff --git a/core/tauri-utils/src/acl/build.rs b/core/tauri-utils/src/acl/build.rs index 582c8016ce4c..76b0cb8723b0 100644 --- a/core/tauri-utils/src/acl/build.rs +++ b/core/tauri-utils/src/acl/build.rs @@ -435,8 +435,6 @@ identifier = "deny-{slugified_command}" description = "Denies the {command} command without any pre-configured scope." commands.deny = ["{command}"] "###, - command = command, - slugified_command = slugified_command, ); let out_path = path.join(format!("{command}.toml")); diff --git a/core/tauri/build.rs b/core/tauri/build.rs index a0704e3dbc87..76a1d23da37c 100644 --- a/core/tauri/build.rs +++ b/core/tauri/build.rs @@ -229,7 +229,7 @@ fn main() { alias("custom_protocol", custom_protocol); alias("dev", dev); - println!("cargo:dev={}", dev); + println!("cargo:dev={dev}"); let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); let mobile = target_os == "ios" || target_os == "android"; @@ -257,10 +257,7 @@ fn main() { if let Ok(kotlin_out_dir) = std::env::var("WRY_ANDROID_KOTLIN_FILES_OUT_DIR") { fn env_var(var: &str) -> String { std::env::var(var).unwrap_or_else(|_| { - panic!( - "`{}` is not set, which is needed to generate the kotlin files for android.", - var - ) + panic!("`{var}` is not set, which is needed to generate the kotlin files for android.") }) } @@ -346,7 +343,7 @@ fn define_permissions(out_dir: &Path) { .filter(|(_cmd, default)| *default) .map(|(cmd, _)| { let slugified_command = cmd.replace('_', "-"); - format!("\"allow-{}\"", slugified_command) + format!("\"allow-{slugified_command}\"") }) .collect::>() .join(", "); diff --git a/core/tauri/src/event/mod.rs b/core/tauri/src/event/mod.rs index 2086a7d6266a..5338bfeb32fb 100644 --- a/core/tauri/src/event/mod.rs +++ b/core/tauri/src/event/mod.rs @@ -175,22 +175,20 @@ pub fn listen_js_script( ) -> String { format!( "(function () {{ - if (window['{listeners}'] === void 0) {{ - Object.defineProperty(window, '{listeners}', {{ value: Object.create(null) }}); + if (window['{listeners_object_name}'] === void 0) {{ + Object.defineProperty(window, '{listeners_object_name}', {{ value: Object.create(null) }}); }} - if (window['{listeners}']['{event}'] === void 0) {{ - Object.defineProperty(window['{listeners}'], '{event}', {{ value: Object.create(null) }}); + if (window['{listeners_object_name}']['{event}'] === void 0) {{ + Object.defineProperty(window['{listeners_object_name}'], '{event}', {{ value: Object.create(null) }}); }} - const eventListeners = window['{listeners}']['{event}'] + const eventListeners = window['{listeners_object_name}']['{event}'] const listener = {{ - target: {target}, + target: {serialized_target}, handler: {handler} }}; Object.defineProperty(eventListeners, '{event_id}', {{ value: listener, configurable: true }}); }})() ", - listeners = listeners_object_name, - target = serialized_target, ) } diff --git a/core/tauri/src/manager/mod.rs b/core/tauri/src/manager/mod.rs index f16d2bba0184..a94ab8a273f5 100644 --- a/core/tauri/src/manager/mod.rs +++ b/core/tauri/src/manager/mod.rs @@ -759,9 +759,7 @@ mod test { assert_eq!( received.len(), expected.len(), - "received {:?} `{kind}` events but expected {:?}", - received, - expected + "received {received:?} `{kind}` events but expected {expected:?}" ); } diff --git a/core/tauri/src/test/mod.rs b/core/tauri/src/test/mod.rs index 2fa7a141a929..c33e38544d22 100644 --- a/core/tauri/src/test/mod.rs +++ b/core/tauri/src/test/mod.rs @@ -314,7 +314,7 @@ mod tests { }); app.run(|_app, event| { - println!("{:?}", event); + println!("{event:?}"); }); } } diff --git a/examples/commands/main.rs b/examples/commands/main.rs index b12d8642907b..aa0641de093b 100644 --- a/examples/commands/main.rs +++ b/examples/commands/main.rs @@ -219,7 +219,7 @@ fn borrow_cmd_async(the_argument: &str) -> &str { #[command] fn raw_request(request: Request<'_>) -> Response { - println!("{:?}", request); + println!("{request:?}"); Response::new(include_bytes!("./README.md").to_vec()) }