Skip to content

Commit

Permalink
Merge pull request #69 from DaniD3v/unused_allows
Browse files Browse the repository at this point in the history
Removed unused #[allow()]'s
  • Loading branch information
Snowiiii authored Sep 6, 2024
2 parents e3c392c + 12e3732 commit 15cceb5
Show file tree
Hide file tree
Showing 21 changed files with 22 additions and 31 deletions.
1 change: 0 additions & 1 deletion pumpkin-core/src/text/hover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use super::Text;

#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(tag = "action", content = "contents", rename_all = "snake_case")]
#[allow(clippy::enum_variant_names)]
pub enum HoverEvent<'a> {
/// Displays a tooltip with the given text.
ShowText(Text<'a>),
Expand Down
1 change: 0 additions & 1 deletion pumpkin-inventory/src/player.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use pumpkin_world::item::Item;

#[allow(dead_code)]
pub struct PlayerInventory {
// Main Inventory + Hotbar
crafting: [Option<Item>; 4],
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/client/play/c_login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub struct CLogin<'a> {
}

impl<'a> CLogin<'a> {
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub fn new(
entity_id: i32,
is_hardcore: bool,
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/client/play/c_particle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct CParticle<'a> {
}

impl<'a> CParticle<'a> {
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub fn new(
long_distance: bool,
x: f64,
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/client/play/c_player_chat_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct CPlayerChatMessage<'a> {
}

impl<'a> CPlayerChatMessage<'a> {
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub fn new(
sender: UUID,
index: VarInt,
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/client/play/c_spawn_player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct CSpawnEntity {
}

impl CSpawnEntity {
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub fn new(
entity_id: VarInt,
entity_uuid: UUID,
Expand Down
3 changes: 1 addition & 2 deletions pumpkin-protocol/src/packet_encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ pub struct PacketEncoder {
}

impl PacketEncoder {
// i think clippy is broken
#[allow(clippy::needless_borrows_for_generic_args)]
pub fn append_packet<P: ClientPacket>(&mut self, packet: &P) -> Result<(), PacketError> {
let start_len = self.buf.len();

Expand Down Expand Up @@ -87,6 +85,7 @@ impl PacketEncoder {

let mut front = &mut self.buf[start_len..];

#[allow(clippy::needless_borrows_for_generic_args)]
VarInt(packet_len as i32)
.encode(&mut front)
.map_err(|_| PacketError::EncodeLength)?;
Expand Down
1 change: 0 additions & 1 deletion pumpkin-protocol/src/slot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use serde::{
};

#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct Slot {
item_count: VarInt,
item_id: Option<VarInt>,
Expand Down
6 changes: 3 additions & 3 deletions pumpkin-world/src/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub struct ChunkHeightmaps {
}

#[derive(Deserialize, Debug)]
#[allow(dead_code)]
#[expect(dead_code)]
struct ChunkSection {
#[serde(rename = "Y")]
y: i32,
Expand All @@ -64,7 +64,7 @@ struct ChunkSection {
#[derive(Deserialize, Debug)]
#[serde(rename_all = "PascalCase")]
struct ChunkNbt {
#[allow(dead_code)]
#[expect(dead_code)]
data_version: usize,

#[serde(rename = "sections")]
Expand Down Expand Up @@ -171,7 +171,7 @@ impl ChunkBlocks {
index.y.get_absolute() as usize * CHUNK_AREA + *index.z as usize * 16 + *index.x as usize
}

#[allow(dead_code)]
#[expect(dead_code)]
fn calculate_heightmap(&self) -> ChunkHeightmaps {
// figure out how LongArray is formatted
// figure out how to find out if block is motion blocking
Expand Down
1 change: 0 additions & 1 deletion pumpkin-world/src/global_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ pub fn get_protocol_id(category: &str, entry: &str) -> u32 {
.expect("No Entry found")
}

#[allow(dead_code)]
pub fn get_default<'a>(category: &str) -> Option<&'a str> {
REGISTRY
.get(category)
Expand Down
4 changes: 2 additions & 2 deletions pumpkin-world/src/item/item_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ pub struct ItemElement {
components: ItemComponents,
}

#[allow(dead_code)]
#[expect(dead_code)]
pub fn get_item_element(item_id: &str) -> &ItemComponents {
&ITEMS.get(item_id).expect("Item not found").components
}

#[allow(dead_code)]
#[expect(dead_code)]
pub fn get_item_protocol_id(item_id: &str) -> u32 {
global_registry::get_protocol_id(ITEM_REGISTRY, item_id)
}
2 changes: 1 addition & 1 deletion pumpkin-world/src/level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub struct Level {
}

struct SaveFile {
#[allow(dead_code)]
#[expect(dead_code)]
root_folder: PathBuf,
region_folder: PathBuf,
}
Expand Down
1 change: 0 additions & 1 deletion pumpkin-world/src/world_gen/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub trait GeneratorInit {
}

pub trait WorldGenerator: Sync + Send {
#[allow(dead_code)]
fn generate_chunk(&self, at: Vector2<i32>) -> ChunkData;
}
assert_obj_safe! {WorldGenerator}
Expand Down
1 change: 0 additions & 1 deletion pumpkin-world/src/world_gen/implementations/superflat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use crate::{
},
};

#[allow(dead_code)]
pub type SuperflatGenerator = GenericGenerator<SuperflatBiomeGenerator, SuperflatTerrainGenerator>;

pub(crate) struct SuperflatBiomeGenerator {}
Expand Down
1 change: 0 additions & 1 deletion pumpkin-world/src/world_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ pub use seed::Seed;
use generator::GeneratorInit;
use implementations::superflat::SuperflatGenerator;

#[allow(dead_code)]
pub fn get_world_gen(seed: Seed) -> Box<dyn WorldGenerator> {
// TODO decide which WorldGenerator to pick based on config.
Box::new(SuperflatGenerator::new(seed))
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-world/src/world_gen/seed.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::hash::{DefaultHasher, Hash, Hasher};

#[allow(dead_code)]
#[expect(dead_code)]
#[derive(Clone, Copy)]
pub struct Seed(pub i64);

Expand Down
7 changes: 3 additions & 4 deletions pumpkin/src/client/authentication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use uuid::Uuid;
use crate::server::Server;

#[derive(Deserialize, Clone, Debug)]
#[allow(non_snake_case)]
#[allow(dead_code)]
#[expect(non_snake_case)]
#[expect(dead_code)]
pub struct ProfileTextures {
timestamp: i64,
profileId: Uuid,
Expand All @@ -24,8 +24,7 @@ pub struct ProfileTextures {
}

#[derive(Deserialize, Clone, Debug)]
#[allow(non_snake_case)]
#[allow(dead_code)]
#[expect(dead_code)]
pub struct Texture {
url: String,
metadata: Option<HashMap<String, String>>,
Expand Down
4 changes: 2 additions & 2 deletions pumpkin/src/commands/cmd_gamemode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub(crate) fn init_command_tree<'a>() -> CommandTree<'a> {
)));
} else {
// TODO
#[allow(clippy::let_underscore_future)]
#[expect(clippy::let_underscore_future)]
let _ = target.set_gamemode(gamemode);
target.send_system_message(TextComponent::text(&format!(
"Game mode was set to {:?}",
Expand All @@ -97,7 +97,7 @@ pub(crate) fn init_command_tree<'a>() -> CommandTree<'a> {
)));
} else {
// TODO
#[allow(clippy::let_underscore_future)]
#[expect(clippy::let_underscore_future)]
let _ = target.set_gamemode(gamemode);
target.send_system_message(TextComponent::text(&format!(
"Game mode was set to {:?}",
Expand Down
5 changes: 3 additions & 2 deletions pumpkin/src/commands/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ pub(crate) enum NodeType<'a> {
run: &'a (dyn Fn(&mut CommandSender, &mut Server, &ConsumedArgs) -> Result<(), InvalidTreeError>
+ Sync),
},
#[allow(dead_code)] // todo: remove (so far no commands requiring this are implemented)
Literal { string: &'a str },
Literal {
string: &'a str,
},
Argument {
name: &'a str,
consumer: ArgumentConsumer<'a>,
Expand Down
2 changes: 1 addition & 1 deletion pumpkin/src/commands/tree_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl<'a> NonLeafNodeBuilder<'a> {
}

/// Matches a sting literal.
#[allow(dead_code)] // todo: remove (so far no commands requiring this are implemented)
#[expect(dead_code)] // todo: remove (so far no commands requiring this are implemented)
pub fn literal(string: &str) -> NonLeafNodeBuilder {
NonLeafNodeBuilder {
node_type: NodeType::Literal { string },
Expand Down
3 changes: 1 addition & 2 deletions pumpkin/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(clippy::await_holding_refcell_ref)]
#![allow(clippy::await_holding_lock)]
#![expect(clippy::await_holding_lock)]

#[cfg(target_os = "wasi")]
compile_error!("Compiling for WASI targets is not supported!");
Expand Down

0 comments on commit 15cceb5

Please sign in to comment.