clippy and format

This commit is contained in:
Edvin Bryntesson 2024-09-05 14:57:11 +02:00
parent bb6677dd19
commit 4551d0bd0d
No known key found for this signature in database
7 changed files with 8 additions and 11 deletions

View File

@ -4,9 +4,7 @@ use itertools::Itertools;
use num_traits::Euclid;
use pumpkin_world::item::ItemStack;
use std::collections::HashMap;
use std::iter::{Enumerate, Filter, TakeWhile};
use std::sync::{Arc, Mutex, RwLock};
use std::vec::IntoIter;
#[derive(Debug, Default)]
pub struct DragHandler(RwLock<HashMap<u64, Arc<Mutex<Drag>>>>);
@ -76,7 +74,7 @@ impl DragHandler {
let Some((_, drag)) = drags.remove_entry(container_id) else {
Err(InventoryError::OutOfOrderDragging)?
};
let mut drag = drag.lock().unwrap();
let drag = drag.lock().unwrap();
if player != drag.player {
Err(InventoryError::MultiplePlayersDragging)?

View File

@ -1,4 +1,4 @@
use crate::container_click::{MouseClick, MouseDragState, MouseDragType};
use crate::container_click::MouseClick;
use crate::player::PlayerInventory;
use num_derive::{FromPrimitive, ToPrimitive};
use pumpkin_world::item::ItemStack;

View File

@ -1,7 +1,6 @@
use crate::drag_handler::DragHandler;
use crate::{Container, WindowType};
use pumpkin_world::item::ItemStack;
use std::sync::{Arc, Mutex};
use std::sync::Mutex;
pub struct OpenContainer {
players: Vec<i32>,

View File

@ -1,5 +1,4 @@
use crate::container_click::MouseClick;
use crate::drag_handler::DragHandler;
use crate::{handle_item_change, Container, InventoryError, WindowType};
use pumpkin_world::item::ItemStack;

View File

@ -3,7 +3,7 @@ use crate::server::Server;
use itertools::Itertools;
use pumpkin_core::text::TextComponent;
use pumpkin_core::GameMode;
use pumpkin_inventory::container_click::{KeyClick, MouseClick, MouseDragState, MouseDragType};
use pumpkin_inventory::container_click::{KeyClick, MouseClick, MouseDragState};
use pumpkin_inventory::drag_handler::DragHandler;
use pumpkin_inventory::window_property::{WindowProperty, WindowPropertyTrait};
use pumpkin_inventory::{container_click, InventoryError, OptionallyCombinedContainer};
@ -14,7 +14,7 @@ use pumpkin_protocol::client::play::{
use pumpkin_protocol::server::play::SClickContainer;
use pumpkin_protocol::slot::Slot;
use pumpkin_world::item::ItemStack;
use std::sync::{Arc, Mutex, MutexGuard};
use std::sync::Mutex;
impl Player {
pub fn open_container(

View File

@ -452,7 +452,8 @@ impl Player {
Ok(())
}
SClickContainer::PACKET_ID => {
self.handle_click_container(server, SClickContainer::read(bytebuf)?);
self.handle_click_container(server, SClickContainer::read(bytebuf)?)
.unwrap();
Ok(())
}
SCloseContainer::PACKET_ID => {

View File

@ -16,7 +16,7 @@ use std::{
path::Path,
sync::{
atomic::{AtomicI32, Ordering},
Arc, Mutex, MutexGuard,
Arc, Mutex,
},
time::Duration,
};