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
This commit is contained in:
Purdze 2026-03-02 23:31:47 +00:00
parent 640d6268ab
commit fff0592875
3 changed files with 5 additions and 12 deletions

View File

@ -6,8 +6,9 @@ use crate::{
pub fn ffi_native_bridge_get_patch_bukkit_config_impl(
_request: EmptyRequest,
) -> Option<GetPatchBukkitConfigResponse> {
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
}
}

View File

@ -37,7 +37,6 @@ pub mod config;
pub use config::*;
pub mod itemstack;
pub use itemstack::*;
static CALLBACK_CONTEXT: OnceLock<CallbackContext> = OnceLock::new();

View File

@ -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(