Skip to content

Commit

Permalink
Fix cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
vyPal committed Dec 27, 2024
1 parent 4b31468 commit 80b1d62
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 22 deletions.
20 changes: 9 additions & 11 deletions plugins/hello-plugin-source/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,16 @@ impl CommandExecutor for SetblockExecutor {

pub fn init_command_tree() -> CommandTree {
CommandTree::new(NAMES, DESCRIPTION).with_child(
require(|sender| {
sender.has_permission_lvl(PermissionLvl::Two) && sender.world().is_some()
})
.with_child(
argument(ARG_BLOCK_POS, BlockPosArgumentConsumer).with_child(
argument(ARG_BLOCK, BlockArgumentConsumer)
.with_child(literal("replace").execute(SetblockExecutor(Mode::Replace)))
.with_child(literal("destroy").execute(SetblockExecutor(Mode::Destroy)))
.with_child(literal("keep").execute(SetblockExecutor(Mode::Keep)))
.execute(SetblockExecutor(Mode::Replace)),
require(|sender| sender.has_permission_lvl(PermissionLvl::Two) && sender.world().is_some())
.with_child(
argument(ARG_BLOCK_POS, BlockPosArgumentConsumer).with_child(
argument(ARG_BLOCK, BlockArgumentConsumer)
.with_child(literal("replace").execute(SetblockExecutor(Mode::Replace)))
.with_child(literal("destroy").execute(SetblockExecutor(Mode::Destroy)))
.with_child(literal("keep").execute(SetblockExecutor(Mode::Keep)))
.execute(SetblockExecutor(Mode::Replace)),
),
),
),
)
}

Expand Down
12 changes: 6 additions & 6 deletions pumpkin-api-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,14 @@ pub fn plugin_impl(attr: TokenStream, item: TokenStream) -> TokenStream {
#[proc_macro_attribute]
pub fn with_runtime(attr: TokenStream, item: TokenStream) -> TokenStream {
let mut input = parse_macro_input!(item as ItemImpl);

let use_global = attr.to_string() == "global";

for item in &mut input.items {
if let ImplItem::Fn(method) = item {
if method.sig.asyncness.is_some() {
let original_body = &method.block;

method.block = if use_global {
parse_quote!({
crate::GLOBAL_RUNTIME.block_on(async move {
Expand All @@ -245,11 +245,11 @@ pub fn with_runtime(attr: TokenStream, item: TokenStream) -> TokenStream {
})
})
};

method.sig.asyncness = None;
}
}
}

TokenStream::from(quote!(#input))
}
}
5 changes: 1 addition & 4 deletions pumpkin-nbt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,7 @@ mod test {
use crate::BytesArray;
use crate::IntArray;
use crate::LongArray;
use crate::{
deserializer::from_bytes_unnamed,
serializer::to_bytes_unnamed,
};
use crate::{deserializer::from_bytes_unnamed, serializer::to_bytes_unnamed};

#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct Test {
Expand Down
1 change: 0 additions & 1 deletion pumpkin/src/command/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ pub trait GetClientSideArgParser {
fn get_client_side_suggestion_type_override(&self) -> Option<ProtoCmdArgSuggestionType>;
}


pub trait DefaultNameArgConsumer: ArgumentConsumer {
fn default_name(&self) -> String;
}
Expand Down

0 comments on commit 80b1d62

Please sign in to comment.