From fff059287554275d5080da78336fccd49d2d9121 Mon Sep 17 00:00:00 2001 From: Purdze Date: Mon, 2 Mar 2026 23:31:47 +0000 Subject: [PATCH] Fix clippy and fmt issues - Use Option::map instead of manual if-let-some in config callback - Remove unused itemstack re-export - Apply cargo fmt --- rust/src/java/native_callbacks/config.rs | 8 +++----- rust/src/java/native_callbacks/mod.rs | 1 - rust/src/java/plugin/command_manager.rs | 8 ++------ 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/rust/src/java/native_callbacks/config.rs b/rust/src/java/native_callbacks/config.rs index 04e8730..eed3dec 100644 --- a/rust/src/java/native_callbacks/config.rs +++ b/rust/src/java/native_callbacks/config.rs @@ -6,8 +6,9 @@ use crate::{ pub fn ffi_native_bridge_get_patch_bukkit_config_impl( _request: EmptyRequest, ) -> Option { - if let Some(context) = CALLBACK_CONTEXT.get() { - Some(GetPatchBukkitConfigResponse { + CALLBACK_CONTEXT + .get() + .map(|context| GetPatchBukkitConfigResponse { minimum_supported_plugin_api: context .config .settings @@ -15,7 +16,4 @@ pub fn ffi_native_bridge_get_patch_bukkit_config_impl( .clone() .unwrap_or("0.0.0".to_string()), }) - } else { - None - } } diff --git a/rust/src/java/native_callbacks/mod.rs b/rust/src/java/native_callbacks/mod.rs index b2a72a5..56698aa 100644 --- a/rust/src/java/native_callbacks/mod.rs +++ b/rust/src/java/native_callbacks/mod.rs @@ -37,7 +37,6 @@ pub mod config; pub use config::*; pub mod itemstack; -pub use itemstack::*; static CALLBACK_CONTEXT: OnceLock = OnceLock::new(); diff --git a/rust/src/java/plugin/command_manager.rs b/rust/src/java/plugin/command_manager.rs index bc0c8ab..419e508 100644 --- a/rust/src/java/plugin/command_manager.rs +++ b/rust/src/java/plugin/command_manager.rs @@ -279,17 +279,13 @@ impl CommandManager { ); let j_player = jvm.create_instance( "org.patchbukkit.entity.PatchBukkitPlayer", - &[ - InvocationArg::from(j_uuid), - InvocationArg::try_from(name)?, - ], + &[InvocationArg::from(j_uuid), InvocationArg::try_from(name)?], )?; jvm.invoke( &j_player, "setOp", - &[InvocationArg::try_from(true)? - .into_primitive()?], + &[InvocationArg::try_from(true)?.into_primitive()?], )?; jvm.invoke(