chore: clippy 1.88 (#13720)

This commit is contained in:
Fabian-Lars
2025-06-27 15:33:36 +02:00
committed by GitHub
parent b6de1c89c2
commit 6b2b9d6cbf
36 changed files with 90 additions and 113 deletions

View File

@@ -52,7 +52,7 @@ fn main() {
.expect("Something wrong with tauri_data"),
&serde_json::to_value(all_data).expect("Unable to build final json (all)"),
)
.unwrap_or_else(|_| panic!("Unable to write {:?}", tauri_data));
.unwrap_or_else(|_| panic!("Unable to write {tauri_data:?}"));
utils::write_json(
tauri_recent
@@ -60,5 +60,5 @@ fn main() {
.expect("Something wrong with tauri_recent"),
&serde_json::to_value(recent).expect("Unable to build final json (recent)"),
)
.unwrap_or_else(|_| panic!("Unable to write {:?}", tauri_recent));
.unwrap_or_else(|_| panic!("Unable to write {tauri_recent:?}"));
}

View File

@@ -89,7 +89,7 @@ fn run_max_mem_benchmark() -> Result<HashMap<String, u64>> {
let mut results = HashMap::<String, u64>::new();
for (name, example_exe) in get_all_benchmarks() {
let benchmark_file = utils::target_dir().join(format!("mprof{}_.dat", name));
let benchmark_file = utils::target_dir().join(format!("mprof{name}_.dat"));
let benchmark_file = benchmark_file.to_str().unwrap();
let proc = Command::new("mprof")
@@ -105,7 +105,7 @@ fn run_max_mem_benchmark() -> Result<HashMap<String, u64>> {
.spawn()?;
let proc_result = proc.wait_with_output()?;
println!("{:?}", proc_result);
println!("{proc_result:?}");
results.insert(
name.to_string(),
utils::parse_max_mem(benchmark_file).unwrap(),
@@ -126,11 +126,11 @@ fn rlib_size(target_dir: &std::path::Path, prefix: &str) -> u64 {
if name.starts_with(prefix) && name.ends_with(".rlib") {
let start = name.split('-').next().unwrap().to_string();
if seen.contains(&start) {
println!("skip {}", name);
println!("skip {name}");
} else {
seen.insert(start);
size += entry.metadata().unwrap().len();
println!("check size {} {}", name, size);
println!("check size {name} {size}");
}
}
}
@@ -142,7 +142,7 @@ fn get_binary_sizes(target_dir: &Path) -> Result<HashMap<String, u64>> {
let mut sizes = HashMap::<String, u64>::new();
let wry_size = rlib_size(target_dir, "libwry");
println!("wry {} bytes", wry_size);
println!("wry {wry_size} bytes");
sizes.insert("wry_rlib".to_string(), wry_size);
// add size for all EXEC_TIME_BENCHMARKS

View File

@@ -96,8 +96,8 @@ pub fn run_collect(cmd: &[&str]) -> (String, String) {
let stdout = String::from_utf8_lossy(&stdout).to_string();
let stderr = String::from_utf8_lossy(&stderr).to_string();
if !status.success() {
eprintln!("stdout: <<<{}>>>", stdout);
eprintln!("stderr: <<<{}>>>", stderr);
eprintln!("stdout: <<<{stdout}>>>");
eprintln!("stderr: <<<{stderr}>>>");
panic!("Unexpected exit code: {:?}", status.code());
}
(stdout, stderr)
@@ -230,7 +230,7 @@ pub fn download_file(url: &str, filename: PathBuf) {
// Downloading with curl this saves us from adding
// a Rust HTTP client dependency.
println!("Downloading {}", url);
println!("Downloading {url}");
let status = Command::new("curl")
.arg("-L")
.arg("-s")

View File

@@ -27,8 +27,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
Arch::Armhf => "armhf",
target => {
return Err(crate::Error::ArchError(format!(
"Unsupported architecture: {:?}",
target
"Unsupported architecture: {target:?}"
)));
}
};

View File

@@ -49,8 +49,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
Arch::Riscv64 => "riscv64",
target => {
return Err(crate::Error::ArchError(format!(
"Unsupported architecture: {:?}",
target
"Unsupported architecture: {target:?}"
)));
}
};
@@ -164,7 +163,7 @@ fn generate_control_file(
let dest_path = control_dir.join("control");
let mut file = fs_utils::create_file(&dest_path)?;
let package = heck::AsKebabCase(settings.product_name());
writeln!(file, "Package: {}", package)?;
writeln!(file, "Package: {package}")?;
writeln!(file, "Version: {}", settings.version_string())?;
writeln!(file, "Architecture: {arch}")?;
// 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(
writeln!(file, "Maintainer: {authors}")?;
if let Some(section) = &settings.deb().section {
writeln!(file, "Section: {}", section)?;
writeln!(file, "Section: {section}")?;
}
if let Some(priority) = &settings.deb().priority {
writeln!(file, "Priority: {}", priority)?;
writeln!(file, "Priority: {priority}")?;
} else {
writeln!(file, "Priority: optional")?;
}
if let Some(homepage) = settings.homepage_url() {
writeln!(file, "Homepage: {}", homepage)?;
writeln!(file, "Homepage: {homepage}")?;
}
let dependencies = settings.deb().depends.as_ref().cloned().unwrap_or_default();

View File

@@ -32,8 +32,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
Arch::Riscv64 => "riscv64",
target => {
return Err(crate::Error::ArchError(format!(
"Unsupported architecture: {:?}",
target
"Unsupported architecture: {target:?}"
)));
}
};

View File

@@ -65,15 +65,11 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
if app_bundle_path.exists() {
fs::remove_dir_all(&app_bundle_path)
.with_context(|| format!("Failed to remove old {}", app_product_name))?;
.with_context(|| format!("Failed to remove old {app_product_name}"))?;
}
let bundle_directory = app_bundle_path.join("Contents");
fs::create_dir_all(&bundle_directory).with_context(|| {
format!(
"Failed to create bundle directory at {:?}",
bundle_directory
)
})?;
fs::create_dir_all(&bundle_directory)
.with_context(|| format!("Failed to create bundle directory at {bundle_directory:?}"))?;
let resources_dir = bundle_directory.join("Resources");
let bin_dir = bundle_directory.join("MacOS");
@@ -160,7 +156,7 @@ fn copy_binaries_to_bundle(
let bin_path = settings.binary_path(bin);
let dest_path = dest_dir.join(bin.name());
fs_utils::copy_file(&bin_path, &dest_path)
.with_context(|| format!("Failed to copy binary from {:?}", bin_path))?;
.with_context(|| format!("Failed to copy binary from {bin_path:?}"))?;
paths.push(dest_path);
}
Ok(paths)
@@ -176,10 +172,10 @@ fn copy_custom_files_to_bundle(bundle_directory: &Path, settings: &Settings) ->
};
if path.is_file() {
fs_utils::copy_file(path, &bundle_directory.join(contents_path))
.with_context(|| format!("Failed to copy file {:?} to {:?}", path, contents_path))?;
.with_context(|| format!("Failed to copy file {path:?} to {contents_path:?}"))?;
} else {
fs_utils::copy_dir(path, &bundle_directory.join(contents_path))
.with_context(|| format!("Failed to copy directory {:?} to {:?}", path, contents_path))?;
.with_context(|| format!("Failed to copy directory {path:?} to {contents_path:?}"))?;
}
}
Ok(())
@@ -359,7 +355,7 @@ fn create_info_plist(
// Copies the framework under `{src_dir}/{framework}.framework` to `{dest_dir}/{framework}.framework`.
fn copy_framework_from(dest_dir: &Path, framework: &str, src_dir: &Path) -> crate::Result<bool> {
let src_name = format!("{}.framework", framework);
let src_name = format!("{framework}.framework");
let src_path = src_dir.join(&src_name);
if src_path.exists() {
fs_utils::copy_dir(&src_path, &dest_dir.join(&src_name))?;
@@ -387,7 +383,7 @@ fn copy_frameworks_to_bundle(
}
let dest_dir = bundle_directory.join("Frameworks");
fs::create_dir_all(bundle_directory)
.with_context(|| format!("Failed to create Frameworks directory at {:?}", dest_dir))?;
.with_context(|| format!("Failed to create Frameworks directory at {dest_dir:?}"))?;
for framework in frameworks.iter() {
if framework.ends_with(".framework") {
let src_path = PathBuf::from(framework);
@@ -402,8 +398,7 @@ fn copy_frameworks_to_bundle(
let src_path = PathBuf::from(framework);
if !src_path.exists() {
return Err(crate::Error::GenericError(format!(
"Library not found: {}",
framework
"Library not found: {framework}"
)));
}
let src_name = src_path.file_name().expect("Couldn't get library filename");
@@ -416,8 +411,7 @@ fn copy_frameworks_to_bundle(
continue;
} else if framework.contains('/') {
return Err(crate::Error::GenericError(format!(
"Framework path should have .framework extension: {}",
framework
"Framework path should have .framework extension: {framework}"
)));
}
if let Some(home_dir) = dirs::home_dir() {
@@ -435,8 +429,7 @@ fn copy_frameworks_to_bundle(
continue;
}
return Err(crate::Error::GenericError(format!(
"Could not locate framework: {}",
framework
"Could not locate framework: {framework}"
)));
}
Ok(paths)

View File

@@ -49,8 +49,7 @@ pub fn bundle_project(settings: &Settings, bundles: &[Bundle]) -> crate::Result<
Arch::Universal => "universal",
target => {
return Err(crate::Error::ArchError(format!(
"Unsupported architecture: {:?}",
target
"Unsupported architecture: {target:?}"
)));
}
}
@@ -59,7 +58,7 @@ pub fn bundle_project(settings: &Settings, bundles: &[Bundle]) -> crate::Result<
let dmg_path = output_path.join(&dmg_name);
let product_name = settings.product_name();
let bundle_file_name = format!("{}.app", product_name);
let bundle_file_name = format!("{product_name}.app");
let bundle_dir = settings.project_out_directory().join("bundle/macos");
let support_directory_path = output_path
@@ -69,10 +68,10 @@ pub fn bundle_project(settings: &Settings, bundles: &[Bundle]) -> crate::Result<
for path in &[&support_directory_path, &output_path] {
if path.exists() {
fs::remove_dir_all(path).with_context(|| format!("Failed to remove old {}", dmg_name))?;
fs::remove_dir_all(path).with_context(|| format!("Failed to remove old {dmg_name}"))?;
}
fs::create_dir_all(path)
.with_context(|| format!("Failed to create output directory at {:?}", path))?;
.with_context(|| format!("Failed to create output directory at {path:?}"))?;
}
// create paths for script

View File

@@ -45,16 +45,16 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
if app_bundle_path.exists() {
fs::remove_dir_all(&app_bundle_path)
.with_context(|| format!("Failed to remove old {}", app_product_name))?;
.with_context(|| format!("Failed to remove old {app_product_name}"))?;
}
fs::create_dir_all(&app_bundle_path)
.with_context(|| format!("Failed to create bundle directory at {:?}", app_bundle_path))?;
.with_context(|| format!("Failed to create bundle directory at {app_bundle_path:?}"))?;
for src in settings.resource_files() {
let src = src?;
let dest = app_bundle_path.join(tauri_utils::resources::resource_relpath(&src));
fs_utils::copy_file(&src, &dest)
.with_context(|| format!("Failed to copy resource file {:?}", src))?;
.with_context(|| format!("Failed to copy resource file {src:?}"))?;
}
let icon_filenames = generate_icon_files(&app_bundle_path, settings)
@@ -65,7 +65,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
for bin in settings.binaries() {
let bin_path = settings.binary_path(bin);
fs_utils::copy_file(&bin_path, &app_bundle_path.join(bin.name()))
.with_context(|| format!("Failed to copy binary from {:?}", bin_path))?;
.with_context(|| format!("Failed to copy binary from {bin_path:?}"))?;
}
Ok(vec![app_bundle_path])
@@ -197,7 +197,7 @@ fn generate_info_plist(
if !icon_filenames.is_empty() {
writeln!(file, " <key>CFBundleIconFiles</key>\n <array>")?;
for filename in icon_filenames {
writeln!(file, " <string>{}</string>", filename)?;
writeln!(file, " <string>{filename}</string>")?;
}
writeln!(file, " </array>")?;
}

View File

@@ -177,7 +177,7 @@ impl ResourceDirectory {
directories.push_str(wix_string.as_str());
}
let wix_string = if self.name.is_empty() {
format!("{}{}", files, directories)
format!("{files}{directories}")
} else {
format!(
r#"<Directory Id="I{id}" Name="{name}">{files}{directories}</Directory>"#,
@@ -221,8 +221,7 @@ fn app_installer_output_path(
Arch::AArch64 => "arm64",
target => {
return Err(crate::Error::ArchError(format!(
"Unsupported architecture: {:?}",
target
"Unsupported architecture: {target:?}"
)))
}
};
@@ -352,8 +351,7 @@ fn run_candle(
Arch::AArch64 => "arm64",
target => {
return Err(crate::Error::ArchError(format!(
"unsupported architecture: {:?}",
target
"unsupported architecture: {target:?}"
)))
}
};
@@ -443,8 +441,7 @@ pub fn build_wix_app_installer(
Arch::AArch64 => "arm64",
target => {
return Err(crate::Error::ArchError(format!(
"unsupported architecture: {:?}",
target
"unsupported architecture: {target:?}"
)))
}
};
@@ -845,7 +842,7 @@ pub fn build_wix_app_installer(
let locale_contents = locale_contents.replace(
"</WixLocalization>",
&format!("{}</WixLocalization>", unset_locale_strings),
&format!("{unset_locale_strings}</WixLocalization>"),
);
let locale_path = output_path.join("locale.wxl");
{

View File

@@ -177,8 +177,7 @@ fn build_nsis_app_installer(
Arch::AArch64 => "arm64",
target => {
return Err(crate::Error::ArchError(format!(
"unsupported architecture: {:?}",
target
"unsupported architecture: {target:?}"
)))
}
};

View File

@@ -98,7 +98,7 @@ pub fn command(options: Options) -> Result<()> {
PermissionEntry::PermissionRef(
p.clone()
.try_into()
.unwrap_or_else(|_| panic!("invalid permission {}", p)),
.unwrap_or_else(|_| panic!("invalid permission {p}")),
)
})
.collect(),

View File

@@ -97,7 +97,7 @@ pub fn run_hook(
.current_dir(cwd)
.envs(env)
.piped()
.with_context(|| format!("failed to run `{}` with `cmd /C`", script))?;
.with_context(|| format!("failed to run `{script}` with `cmd /C`"))?;
#[cfg(not(target_os = "windows"))]
let status = Command::new("sh")
.arg("-c")

View File

@@ -225,7 +225,7 @@ pub fn items() -> Vec<SectionItem> {
);
webview2_version()
.map(|v| {
v.map(|v| (format!("WebView2: {}", v), Status::Success))
v.map(|v| (format!("WebView2: {v}"), Status::Success))
.unwrap_or_else(|| (error.clone(), Status::Error))
})
.unwrap_or_else(|_| (error, Status::Error)).into()

View File

@@ -349,7 +349,7 @@ mod tests {
[dependencies]
tauri = {{ version = "1.0.0", features = [{}] }}
"#,
features.iter().map(|f| format!("{:?}", f)).join(", ")
features.iter().map(|f| format!("{f:?}")).join(", ")
)
});
}
@@ -363,7 +363,7 @@ mod tests {
version = "1.0.0"
features = [{}]
"#,
features.iter().map(|f| format!("{:?}", f)).join(", ")
features.iter().map(|f| format!("{f:?}")).join(", ")
)
});
}

View File

@@ -110,7 +110,7 @@ pub fn gen(
map.insert("windows", cfg!(windows));
let identifier = config.app().identifier().replace('.', "/");
let package_path = format!("java/{}", identifier);
let package_path = format!("java/{identifier}");
map.insert("package-path", &package_path);

View File

@@ -314,7 +314,7 @@ fn escape_kotlin_keyword(
.split('.')
.map(|s| {
if KOTLIN_ONLY_KEYWORDS.contains(&s) {
format!("`{}`", s)
format!("`{s}`")
} else {
s.to_string()
}

View File

@@ -207,9 +207,9 @@ pub fn command(options: Options) -> Result<()> {
Some(rust_triple.into()),
)?;
let cflags = format!("CFLAGS_{}", env_triple);
let cxxflags = format!("CFLAGS_{}", env_triple);
let objc_include_path = format!("OBJC_INCLUDE_PATH_{}", env_triple);
let cflags = format!("CFLAGS_{env_triple}");
let cxxflags = format!("CFLAGS_{env_triple}");
let objc_include_path = format!("OBJC_INCLUDE_PATH_{env_triple}");
let mut target_env = host_env.clone();
target_env.insert(cflags.as_ref(), isysroot.as_ref());
target_env.insert(cxxflags.as_ref(), isysroot.as_ref());

View File

@@ -61,7 +61,7 @@ pub fn command(cli: Cli) -> Result<()> {
let plugin_id = prompts::input(
"What should be the Android Package ID for your plugin?",
Some(format!("com.plugin.{}", plugin_name)),
Some(format!("com.plugin.{plugin_name}")),
false,
false,
)?
@@ -114,17 +114,15 @@ tauri-build = "{}"
let init_fn = format!(
r#"
pub fn init<R: Runtime>() -> TauriPlugin<R> {{
Builder::new("{name}")
Builder::new("{plugin_name}")
.setup(|app, api| {{
#[cfg(target_os = "android")]
let handle = api.register_android_plugin("{identifier}", "ExamplePlugin")?;
let handle = api.register_android_plugin("{plugin_id}", "ExamplePlugin")?;
Ok(())
}})
.build()
}}
"#,
name = plugin_name,
identifier = plugin_id
"#
);
log::info!("Android project added");

View File

@@ -156,7 +156,7 @@ pub fn command(mut options: Options) -> Result<()> {
let plugin_id = if options.android || options.mobile {
let plugin_id = prompts::input(
"What should be the Android Package ID for your plugin?",
Some(format!("com.plugin.{}", plugin_name)),
Some(format!("com.plugin.{plugin_name}")),
false,
false,
)?

View File

@@ -126,19 +126,18 @@ tauri-build = "{}"
let init_fn = format!(
r#"
#[cfg(target_os = "ios")]
tauri::ios_plugin_binding!(init_plugin_{name});
tauri::ios_plugin_binding!(init_plugin_{plugin_name});
pub fn init<R: Runtime>() -> TauriPlugin<R> {{
Builder::new("{name}")
Builder::new("{plugin_name}")
.setup(|app| {{
#[cfg(target_os = "ios")]
app.register_ios_plugin(init_plugin_{name})?;
app.register_ios_plugin(init_plugin_{plugin_name})?;
Ok(())
}})
.build()
}}
"#,
name = plugin_name,
);
log::info!("iOS project added");

View File

@@ -29,14 +29,14 @@ impl From<pico_args::Arguments> for Args {
fn from(mut args: pico_args::Arguments) -> Self {
// if the user wanted help, we don't care about parsing the rest of the args
if args.contains(["-h", "--help"]) {
println!("{}", HELP);
println!("{HELP}");
std::process::exit(0);
}
let native_driver = match args.opt_value_from_str("--native-driver") {
Ok(native_driver) => native_driver,
Err(e) => {
eprintln!("Error while parsing option --native-driver: {}", e);
eprintln!("Error while parsing option --native-driver: {e}");
std::process::exit(1);
}
};
@@ -53,8 +53,8 @@ impl From<pico_args::Arguments> for Args {
// be strict about accepting args, error for anything extraneous
let rest = args.finish();
if !rest.is_empty() {
eprintln!("Error: unused arguments left: {:?}", rest);
eprintln!("{}", HELP);
eprintln!("Error: unused arguments left: {rest:?}");
eprintln!("{HELP}");
std::process::exit(1);
}

View File

@@ -46,7 +46,7 @@ fn main() {
// start our webdriver intermediary node
if let Err(e) = server::run(args, driver) {
eprintln!("error while running server: {}", e);
eprintln!("error while running server: {e}");
std::process::exit(1);
}
}

View File

@@ -222,7 +222,7 @@ pub async fn run(args: Args, mut _driver: Child) -> Result<(), Error> {
)
.await
{
println!("Error serving connection: {:?}", err);
println!("Error serving connection: {err:?}");
}
});
} else {
@@ -230,7 +230,7 @@ pub async fn run(args: Args, mut _driver: Child) -> Result<(), Error> {
}
}
} else {
println!("can not listen to address: {:?}", address);
println!("can not listen to address: {address:?}");
}
};
srv.await;

View File

@@ -25,7 +25,7 @@ pub fn native(args: &Args) -> Command {
);
match current_dir() {
Ok(cwd) => eprintln!("current working directory: {}", cwd.display()),
Err(error) => eprintln!("can not find current working directory: {}", error),
Err(error) => eprintln!("can not find current working directory: {error}"),
}
std::process::exit(1);
}
@@ -34,11 +34,10 @@ pub fn native(args: &Args) -> Command {
Ok(binary) => binary,
Err(error) => {
eprintln!(
"can not find binary {} in the PATH. This is currently required.\
You can also pass a custom path with --native-driver",
DRIVER_BINARY
"can not find binary {DRIVER_BINARY} in the PATH. This is currently required.\
You can also pass a custom path with --native-driver"
);
eprintln!("{:?}", error);
eprintln!("{error:?}");
std::process::exit(1);
}
},

View File

@@ -187,7 +187,7 @@ impl Keychain {
SigningIdentity::Team(t) => t.certificate_name(),
SigningIdentity::Identifier(i) => i.clone(),
};
println!("Signing with identity \"{}\"", identity);
println!("Signing with identity \"{identity}\"");
println!("Signing {}", path.display());

View File

@@ -42,21 +42,17 @@ impl Team {
.and_then(|v| v.to_string().ok());
let name = if let Some(organization) = organization {
println!(
"found cert {:?} with organization {:?}",
common_name, organization
);
println!("found cert {common_name:?} with organization {organization:?}");
organization
} else {
println!(
"found cert {:?} but failed to get organization; falling back to displaying common name",
common_name
"found cert {common_name:?} but failed to get organization; falling back to displaying common name"
);
regex!(r"Apple Develop\w+: (.*) \(.+\)")
.captures(&common_name)
.map(|caps| caps[1].to_owned())
.unwrap_or_else(|| {
println!("regex failed to capture nice part of name in cert {:?}; falling back to displaying full name", common_name);
println!("regex failed to capture nice part of name in cert {common_name:?}; falling back to displaying full name");
common_name.clone()
})
};
@@ -106,7 +102,7 @@ pub fn list(keychain_path: &Path) -> Result<Vec<Team>> {
.into_iter()
.flat_map(|(cert_prefix, cert)| {
Team::from_x509(cert_prefix, cert).map_err(|err| {
eprintln!("{}", err);
eprintln!("{err}");
err
})
})

View File

@@ -130,7 +130,7 @@ pub fn notarize(
submit_output.status, submit_output.id, submit_output.message
);
if submit_output.status == "Accepted" {
println!("Notarizing {}", log_message);
println!("Notarizing {log_message}");
staple_app(app_bundle_path.to_path_buf())?;
Ok(())
} else if let Ok(output) = Command::new("xcrun")

View File

@@ -184,11 +184,11 @@ fn insert_into_xml(xml: &str, block_identifier: &str, parent_tag: &str, contents
if let Some(index) = line.find(&parent_closing_tag) {
let indentation = " ".repeat(index + 4);
rewritten.push(format!("{}{}", indentation, block_comment));
rewritten.push(format!("{indentation}{block_comment}"));
for l in contents.split('\n') {
rewritten.push(format!("{}{}", indentation, l));
rewritten.push(format!("{indentation}{l}"));
}
rewritten.push(format!("{}{}", indentation, block_comment));
rewritten.push(format!("{indentation}{block_comment}"));
}
rewritten.push(line.to_string());

View File

@@ -89,7 +89,7 @@ pub fn define_permissions<F: Fn(&Path) -> bool>(
.collect::<Vec<PathBuf>>();
let pkg_name_valid_path = pkg_name.replace(':', "-");
let permission_files_path = out_dir.join(format!("{}-permission-files", pkg_name_valid_path));
let permission_files_path = out_dir.join(format!("{pkg_name_valid_path}-permission-files"));
let permission_files_json = serde_json::to_string(&permission_files)?;
fs::write(&permission_files_path, permission_files_json)
.map_err(|e| Error::WriteFile(e, permission_files_path.clone()))?;

View File

@@ -2156,7 +2156,7 @@ impl Display for HeaderSource {
let len = m.len();
let mut i = 0;
for (key, value) in m {
write!(f, "{} {}", key, value)?;
write!(f, "{key} {value}")?;
i += 1;
if i != len {
write!(f, "; ")?;

View File

@@ -45,7 +45,7 @@ pub fn get<R: Runtime>(
&assets,
&"index.html".into(),
&manager,
Csp::Policy(format!("default-src 'none'; frame-src {}", frame_src)),
Csp::Policy(format!("default-src 'none'; frame-src {frame_src}")),
);
let csp = Csp::DirectiveMap(csp_map).to_string();

View File

@@ -86,7 +86,7 @@ pub fn run_app<R: Runtime, F: FnOnce(&App<R>) + Send + 'static>(
let response = app.sample().ping(PingRequest {
value: value.clone(),
on_event: Channel::new(|event| {
println!("got channel event: {:?}", event);
println!("got channel event: {event:?}");
Ok(())
}),
});
@@ -102,7 +102,7 @@ pub fn run_app<R: Runtime, F: FnOnce(&App<R>) + Send + 'static>(
let server = match tiny_http::Server::http("localhost:3003") {
Ok(s) => s,
Err(e) => {
eprintln!("{}", e);
eprintln!("{e}");
std::process::exit(1);
}
};

View File

@@ -56,8 +56,8 @@ fn ping<R: tauri::Runtime>(
scope: tauri::ipc::CommandScope<PingScope>,
global_scope: tauri::ipc::GlobalScope<SampleScope>,
) -> std::result::Result<PingResponse, String> {
println!("local scope {:?}", scope);
println!("global scope {:?}", global_scope);
println!("local scope {scope:?}");
println!("global scope {global_scope:?}");
app
.sample()
.ping(PingRequest {

View File

@@ -22,7 +22,7 @@ fn main() {
let content = std::fs::read_to_string(&path).unwrap();
println!("Resource `assets/index.js` path: {}", path.display());
println!("Resource `assets/index.js` content:\n{}\n", content);
println!("Resource `assets/index.js` content:\n{content}\n");
Ok(())
})

View File

@@ -35,7 +35,7 @@ pub fn run(args: Vec<String>, bin_name: Option<String>, callback: JsFunction) ->
match res {
Ok(_) => function.call(Ok(true), ThreadsafeFunctionCallMode::Blocking),
Err(e) => function.call(
Err(Error::new(Status::GenericFailure, format!("{:#}", e))),
Err(Error::new(Status::GenericFailure, format!("{e:#}"))),
ThreadsafeFunctionCallMode::Blocking,
),
}