jni-http: drop unit let bindings on exception_clear
- Commit
5ae26900e521856af4f5742cbe2a4684c8e4a02f- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-01 21:55 UTC (4 days ago)
- Parents
8c8962f
Workspace clippy (let_unit_value) flagged four let _ = env.exception_clear(); sites. exception_clear returns unit in the current jni API, so the let binding discards nothing; call it as a plain statement. The exception is still cleared at exactly the same points, which is what keeps a pending exception from poisoning the next JNI call. Verified: cargo clippy -p jni_http --all-targets clean, cargo test -p jni_http (12 passed), cargo fmt --check clean.
Diff
library/jni-http/src/main/rust/src/lib.rs
diff --git a/library/jni-http/src/main/rust/src/lib.rs b/library/jni-http/src/main/rust/src/lib.rsindex 822228dc06..fcbe47b28e 100644--- a/library/jni-http/src/main/rust/src/lib.rs+++ b/library/jni-http/src/main/rust/src/lib.rs@@ -92,7 +92,7 @@ pub fn init(env: &mut Env) -> bool { env.get_java_vm(), env.find_class(jni_str!("com/vayunmathur/library/network/NativeHttpBridge")), ) else {- let _ = env.exception_clear();+ env.exception_clear(); return false; }; let Ok(class) = env.new_global_ref(class) else {@@ -107,7 +107,7 @@ pub fn init(env: &mut Env) -> bool { jni_sig!("(Ljava/lang/String;[Ljava/lang/String;)[B"), ) .is_ok();- let _ = env.exception_clear();+ env.exception_clear(); CACHED.set(Cached { vm, class, batch_ok }).is_ok() || CACHED.get().is_some() } @@ -154,7 +154,7 @@ pub fn request_with_env( ) .map_err(|e| { // Leaving a pending exception poisons the next JNI call on this thread.- let _ = env.exception_clear();+ env.exception_clear(); Error::Bridge(format!("request call failed: {e}")) })?; @@ -227,7 +227,7 @@ pub fn request_batch(url: &str, ranges: &[String]) -> Result<Vec<ResponseFrame>> &[JValue::Object(&jurl), JValue::Object(&jranges)], ) .map_err(|e| {- let _ = env.exception_clear();+ env.exception_clear(); Error::Bridge(format!("batch request call failed: {e}")) })?;