From a35577a00ca01a48de745d2fc91a0e1d0745f4d3 Mon Sep 17 00:00:00 2001 From: Quang Truong Date: Fri, 11 Jul 2025 10:53:57 +0200 Subject: [PATCH 1/9] Fix lint warning --- native/chromium_jni_macro/src/jni_allocate.rs | 4 ++-- native/chromium_jni_macro/src/jni_name.rs | 2 +- native/chromium_jni_macro/src/jni_wrap_impl.rs | 8 ++++---- native/chromium_jni_macro/src/utils/jni_utils.rs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/native/chromium_jni_macro/src/jni_allocate.rs b/native/chromium_jni_macro/src/jni_allocate.rs index f52de92..7f347a0 100644 --- a/native/chromium_jni_macro/src/jni_allocate.rs +++ b/native/chromium_jni_macro/src/jni_allocate.rs @@ -88,7 +88,7 @@ fn build_initialization( } let field_ident = field.ident.as_ref().unwrap(); - let func_ident = syn::Ident::new(&format!("jni_{}", field_ident), Span::call_site()); + let func_ident = syn::Ident::new(&format!("jni_{field_ident}"), Span::call_site()); let signature = jni_signature(field); quote! { #field_ident: match env.get_method_id(class, stringify!(#field_ident), #signature) { @@ -143,7 +143,7 @@ fn build_jni_callback( Some(_) => quote! { return chromium_jni_utils::FromJavaValue::from_java_value(env, result); } }; - let func_ident = syn::Ident::new(&format!("jni_{}", field_ident), Span::call_site()); + let func_ident = syn::Ident::new(&format!("jni_{field_ident}"), Span::call_site()); let signature = jni_signature(field); quote! { diff --git a/native/chromium_jni_macro/src/jni_name.rs b/native/chromium_jni_macro/src/jni_name.rs index 150fe72..b7b555d 100644 --- a/native/chromium_jni_macro/src/jni_name.rs +++ b/native/chromium_jni_macro/src/jni_name.rs @@ -76,5 +76,5 @@ pub fn create_jni_fn_name(namespace: &str, name: &str, suffix: &str) -> String { let namespace = namespace.replace('_', "_1").replace('.', "_"); let name = name.replace('_', "_1"); let suffix = suffix.replace('_', "_1"); - format!("Java_{}_{}{}", namespace, name, suffix) + format!("Java_{namespace}_{name}{suffix}") } diff --git a/native/chromium_jni_macro/src/jni_wrap_impl.rs b/native/chromium_jni_macro/src/jni_wrap_impl.rs index 3bafec1..519dff4 100644 --- a/native/chromium_jni_macro/src/jni_wrap_impl.rs +++ b/native/chromium_jni_macro/src/jni_wrap_impl.rs @@ -86,8 +86,8 @@ fn setup_argument( FnArg::Typed(pattern) => &pattern.ty, FnArg::Receiver(_) => todo!(), }; - let arg = Ident::new(&format!("arg{}", index), Span::call_site()); - let param = Ident::new(&format!("param{}", index), Span::call_site()); + let arg = Ident::new(&format!("arg{index}"), Span::call_site()); + let param = Ident::new(&format!("param{index}"), Span::call_site()); let (arg_type, prepare, cleanup) = handle_arg(&arg, ¶m, ty); ( @@ -146,7 +146,7 @@ fn handle_return(retn: &Option) -> (proc_macro2::TokenStream, proc_macro quote! { return result as jni::sys::jlong }, ) } else { - panic!("Invalid return type {:?}", retn); + panic!("Invalid return type {retn:?}"); } } }, @@ -211,7 +211,7 @@ fn handle_arg( { (quote! { #ty }, quote! { #arg }, quote! {}) } else { - panic!("Invalid argument type {:?}", tystr); + panic!("Invalid argument type {tystr:?}"); } } } diff --git a/native/chromium_jni_macro/src/utils/jni_utils.rs b/native/chromium_jni_macro/src/utils/jni_utils.rs index 8d620a5..0b97c7a 100644 --- a/native/chromium_jni_macro/src/utils/jni_utils.rs +++ b/native/chromium_jni_macro/src/utils/jni_utils.rs @@ -29,7 +29,7 @@ fn jni_type_signature(ty: &Type) -> char { match ty { Type::Ptr(_) => 'J', Type::Path(_p) => 'I', - _ => panic!("Unhandled type {:?}", ty), + _ => panic!("Unhandled type {ty:?}"), } } From f34904948992f0a69da5820ee45917f2814eb6b5 Mon Sep 17 00:00:00 2001 From: Quang Truong Date: Fri, 11 Jul 2025 11:07:07 +0200 Subject: [PATCH 2/9] Fix lint warning --- native/chromium_subp/build.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/native/chromium_subp/build.rs b/native/chromium_subp/build.rs index 2a5e4f0..e168dc8 100644 --- a/native/chromium_subp/build.rs +++ b/native/chromium_subp/build.rs @@ -29,8 +29,7 @@ fn link() { if !cef_path.exists() { panic!( - "cargo:warning=Extract and rename cef binary (minimal) distro to {:?}", - cef_path + "cargo:warning=Extract and rename cef binary (minimal) distro to {cef_path:?}" ); } From 17b73f052cba25932efd523df4e6faf82630ac6b Mon Sep 17 00:00:00 2001 From: Quang Truong Date: Fri, 11 Jul 2025 11:11:22 +0200 Subject: [PATCH 3/9] Fix --- native/chromium_swt/build.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/native/chromium_swt/build.rs b/native/chromium_swt/build.rs index aa2eee2..4807cd0 100644 --- a/native/chromium_swt/build.rs +++ b/native/chromium_swt/build.rs @@ -28,8 +28,7 @@ fn link() { let cef_path = get_cef_path(); if !cef_path.exists() { panic!( - "cargo:warning=Extract and rename cef binary (minimal) distro to {:?}", - cef_path + "cargo:warning=Extract and rename cef binary (minimal) distro to {cef_path:?}" ); } From 5e1ffb55bd896e4c528bdec9d9b1026b6a637dbb Mon Sep 17 00:00:00 2001 From: Quang Truong Date: Fri, 11 Jul 2025 11:29:04 +0200 Subject: [PATCH 4/9] Fix --- native/chromium/build.rs | 2 +- native/chromium_subp/build.rs | 2 +- native/chromium_subp/src/app/mod.rs | 10 +++++----- native/chromium_swt/build.rs | 2 +- native/chromium_swt/src/lib.rs | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/native/chromium/build.rs b/native/chromium/build.rs index 0e5596a..959a927 100644 --- a/native/chromium/build.rs +++ b/native/chromium/build.rs @@ -161,7 +161,7 @@ fn generator(cef_path: std::path::Display) -> bindgen::Builder { config.insert(bindgen::CodegenConfig::TYPES); let callbacks = ToJavaCallbacks(); bindgen::builder() - .clang_arg(format!("-I{}", cef_path)) + .clang_arg(format!("-I{cef_path}")) .clang_arg(format!( "-I{}", "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.1A\\Include" diff --git a/native/chromium_subp/build.rs b/native/chromium_subp/build.rs index e168dc8..d3bf16a 100644 --- a/native/chromium_subp/build.rs +++ b/native/chromium_subp/build.rs @@ -34,7 +34,7 @@ fn link() { } // Tell cargo to tell rustc to link the system shared library. - println!("cargo:rustc-link-search={}", cef_path.display()); + println!("cargo:rustc-link-search={cef_path.display()}"); println!("cargo:rustc-link-lib=libcef"); // Set up compiler flags to use the Windows subsystem & Windows CRT diff --git a/native/chromium_subp/src/app/mod.rs b/native/chromium_subp/src/app/mod.rs index b554a74..d7812df 100644 --- a/native/chromium_subp/src/app/mod.rs +++ b/native/chromium_subp/src/app/mod.rs @@ -255,19 +255,19 @@ unsafe fn convert_type( (ret_str, socket::ReturnType::Null) } else if (*ret).is_bool.unwrap()(ret) == 1 { let ret_cef = (*ret).get_bool_value.unwrap()(ret); - let ret_str = CString::new(format!("{}", ret_cef)).unwrap(); + let ret_str = CString::new(format!("{ret_cef}")).unwrap(); (ret_str, socket::ReturnType::Bool) } else if (*ret).is_int.unwrap()(ret) == 1 { let ret_cef = (*ret).get_int_value.unwrap()(ret); - let ret_str = CString::new(format!("{}", ret_cef)).unwrap(); + let ret_str = CString::new(format!("{ret_cef}")).unwrap(); (ret_str, socket::ReturnType::Double) } else if (*ret).is_uint.unwrap()(ret) == 1 { let ret_cef = (*ret).get_uint_value.unwrap()(ret); - let ret_str = CString::new(format!("{}", ret_cef)).unwrap(); + let ret_str = CString::new(format!("{ret_cef}")).unwrap(); (ret_str, socket::ReturnType::Double) } else if (*ret).is_double.unwrap()(ret) == 1 { let ret_cef = (*ret).get_double_value.unwrap()(ret); - let ret_str = CString::new(format!("{}", ret_cef)).unwrap(); + let ret_str = CString::new(format!("{ret_cef}")).unwrap(); (ret_str, socket::ReturnType::Double) } else if (*ret).is_string.unwrap()(ret) == 1 { let ret_str_cef = (*ret).get_string_value.unwrap()(ret); @@ -290,7 +290,7 @@ unsafe fn convert_type( for i in 0..length { let vali = (*array_val).get_value_byindex.unwrap()(array_val, i); let (valcstr, valtyp) = convert_type(vali, _eval_id, context); - let valstr = format!("'{},{}'", valtyp as u32, valcstr.into_string().unwrap()); + let valstr = format!("'{valtyp as u32},{valcstr.into_string().unwrap()}'"); if i > 0 { arraystr.push(';'); } diff --git a/native/chromium_swt/build.rs b/native/chromium_swt/build.rs index 4807cd0..8fdd9a7 100644 --- a/native/chromium_swt/build.rs +++ b/native/chromium_swt/build.rs @@ -33,6 +33,6 @@ fn link() { } // Tell cargo to tell rustc to link the system shared library. - println!("cargo:rustc-link-search={}", cef_path.display()); + println!("cargo:rustc-link-search={cef_path.display()}"); println!("cargo:rustc-link-lib=libcef"); } diff --git a/native/chromium_swt/src/lib.rs b/native/chromium_swt/src/lib.rs index ca7c2c7..1374a25 100644 --- a/native/chromium_swt/src/lib.rs +++ b/native/chromium_swt/src/lib.rs @@ -104,11 +104,11 @@ pub fn cefswt_init( fn set_env_var(cef_path: &str, var: &str, sep: &str) { match std::env::var(var) { Ok(paths) => { - let paths = format!("{}{}{}", cef_path, sep, paths); + let paths = format!("{cef_path}{sep}{paths}"); std::env::set_var(var, paths); } Err(e) => { - println!("Couldn't read {} ({})", var, e); + println!("Couldn't read {var} ({e})"); std::env::set_var(var, cef_path); } }; From d51b64d4cbf184bd926d4ce3836cd33d868eb0e0 Mon Sep 17 00:00:00 2001 From: Quang Truong Date: Fri, 11 Jul 2025 11:47:51 +0200 Subject: [PATCH 5/9] fix --- native/chromium_subp/build.rs | 2 +- native/chromium_swt/build.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/native/chromium_subp/build.rs b/native/chromium_subp/build.rs index d3bf16a..e168dc8 100644 --- a/native/chromium_subp/build.rs +++ b/native/chromium_subp/build.rs @@ -34,7 +34,7 @@ fn link() { } // Tell cargo to tell rustc to link the system shared library. - println!("cargo:rustc-link-search={cef_path.display()}"); + println!("cargo:rustc-link-search={}", cef_path.display()); println!("cargo:rustc-link-lib=libcef"); // Set up compiler flags to use the Windows subsystem & Windows CRT diff --git a/native/chromium_swt/build.rs b/native/chromium_swt/build.rs index 8fdd9a7..4807cd0 100644 --- a/native/chromium_swt/build.rs +++ b/native/chromium_swt/build.rs @@ -33,6 +33,6 @@ fn link() { } // Tell cargo to tell rustc to link the system shared library. - println!("cargo:rustc-link-search={cef_path.display()}"); + println!("cargo:rustc-link-search={}", cef_path.display()); println!("cargo:rustc-link-lib=libcef"); } From f5cca737208114284f3aa4735dc1b11e1e26bf1c Mon Sep 17 00:00:00 2001 From: Quang Truong Date: Fri, 11 Jul 2025 12:00:53 +0200 Subject: [PATCH 6/9] fix --- native/chromium_subp/src/app/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/native/chromium_subp/src/app/mod.rs b/native/chromium_subp/src/app/mod.rs index d7812df..f2691bd 100644 --- a/native/chromium_subp/src/app/mod.rs +++ b/native/chromium_subp/src/app/mod.rs @@ -290,7 +290,9 @@ unsafe fn convert_type( for i in 0..length { let vali = (*array_val).get_value_byindex.unwrap()(array_val, i); let (valcstr, valtyp) = convert_type(vali, _eval_id, context); - let valstr = format!("'{valtyp as u32},{valcstr.into_string().unwrap()}'"); + let typ = valtyp as u32 + let = valcstr.into_string().unwrap() + let valstr = format!("'{typ},{valstr}'"); if i > 0 { arraystr.push(';'); } From 9454fd215cd7dce7ecc85e5da1d49b1ca7f28917 Mon Sep 17 00:00:00 2001 From: Quang Truong Date: Fri, 11 Jul 2025 12:15:38 +0200 Subject: [PATCH 7/9] fix --- native/chromium_subp/src/app/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/native/chromium_subp/src/app/mod.rs b/native/chromium_subp/src/app/mod.rs index f2691bd..ee11d59 100644 --- a/native/chromium_subp/src/app/mod.rs +++ b/native/chromium_subp/src/app/mod.rs @@ -290,8 +290,8 @@ unsafe fn convert_type( for i in 0..length { let vali = (*array_val).get_value_byindex.unwrap()(array_val, i); let (valcstr, valtyp) = convert_type(vali, _eval_id, context); - let typ = valtyp as u32 - let = valcstr.into_string().unwrap() + let typ = valtyp as u32; + let = valcstr.into_string().unwrap(); let valstr = format!("'{typ},{valstr}'"); if i > 0 { arraystr.push(';'); From 1eb72206ae01b6e95d4d494c85e5fa18266970ef Mon Sep 17 00:00:00 2001 From: Quang Truong Date: Fri, 11 Jul 2025 12:26:37 +0200 Subject: [PATCH 8/9] fix --- native/chromium_subp/src/app/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/chromium_subp/src/app/mod.rs b/native/chromium_subp/src/app/mod.rs index ee11d59..1b293b0 100644 --- a/native/chromium_subp/src/app/mod.rs +++ b/native/chromium_subp/src/app/mod.rs @@ -291,7 +291,7 @@ unsafe fn convert_type( let vali = (*array_val).get_value_byindex.unwrap()(array_val, i); let (valcstr, valtyp) = convert_type(vali, _eval_id, context); let typ = valtyp as u32; - let = valcstr.into_string().unwrap(); + let valstr = valcstr.into_string().unwrap(); let valstr = format!("'{typ},{valstr}'"); if i > 0 { arraystr.push(';'); From 297cf72bea8119d06678b0f55a7b52d96f4ef444 Mon Sep 17 00:00:00 2001 From: Quang Truong Date: Fri, 11 Jul 2025 12:40:56 +0200 Subject: [PATCH 9/9] fix --- native/chromium_subp/src/app/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/chromium_subp/src/app/mod.rs b/native/chromium_subp/src/app/mod.rs index 1b293b0..cdb81e9 100644 --- a/native/chromium_subp/src/app/mod.rs +++ b/native/chromium_subp/src/app/mod.rs @@ -203,7 +203,7 @@ fn register_function( handler: &mut V8Handler, ) { // Add the "myfunc" function to the "window" object. - let handler_name = chromium::utils::cef_string(&format!("{}", id)); + let handler_name = chromium::utils::cef_string(&format!("{id}")); let func = unsafe { chromium::cef::cef_v8value_create_function(&handler_name, handler.as_ptr()) }; let s = unsafe {