From 7ec26671bd0f6a46aa562a769fc10a83d6229123 Mon Sep 17 00:00:00 2001 From: comblock <81411315+comblock@users.noreply.github.com> Date: Sat, 4 Feb 2023 15:01:27 +0100 Subject: [PATCH] remove useless cargo features --- Cargo.toml | 4 ++-- net/Cargo.toml | 10 +++++----- net/src/conn/writehalf.rs | 2 -- net/src/encoding.rs | 6 ------ net/src/writer.rs | 1 - 5 files changed, 7 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1169739..eba681d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,10 +10,10 @@ net = ["dep:miners-net"] auth = ["dep:miners-auth"] chat = ["dep:miners-chat"] protocol = ["dep:miners-protocol", "packet", "to_static_derive", "encoding_derive", "nbt"] -packet = ["dep:miners-packet", "miners-net?/packet"] +packet = ["dep:miners-packet"] nbt = ["dep:miners-nbt"] encoding_derive = ["dep:miners-encoding-derive", "encoding"] -encoding = ["dep:miners-encoding", "miners-net?/encoding"] +encoding = ["dep:miners-encoding"] to_static_derive = ["dep:miners-to-static-derive", "to_static"] to_static = ["dep:miners-to-static", "miners-nbt?/to_static"] version = ["dep:miners-version"] diff --git a/net/Cargo.toml b/net/Cargo.toml index 49131e1..a326402 100644 --- a/net/Cargo.toml +++ b/net/Cargo.toml @@ -10,8 +10,8 @@ thiserror = "1.0.37" cfb8 = "0.8.1" aes = "0.8.1" flate2 = "1.0.24" -miners-encoding = { version = "0.0.0-beta.0", optional = true, path = "../encoding" } -miners-packet = { version = "0.0.0-beta.0", optional = true, path = "../packet" } +miners-encoding = { version = "0.0.0-beta.0", path = "../encoding" } +miners-packet = { version = "0.0.0-beta.0", path = "../packet" } miners-version = { version = "0.0.0-beta.0", path = "../version" } futures-lite = "1.12.0" once_cell = { version = "1.14.0", optional = true } @@ -19,7 +19,7 @@ parking_lot = { version = "0.12.1", optional = true } futures-channel = { version = "0.3.24", optional = true } [features] -default = ["encoding", "packet", "workpool"] -packet = ["encoding", "dep:miners-packet"] -encoding = ["dep:miners-encoding"] +default = ["workpool"] +#packet = ["encoding", "dep:miners-packet"] +#encoding = ["dep:miners-encoding"] workpool = ["dep:once_cell", "dep:parking_lot", "dep:futures-channel"] diff --git a/net/src/conn/writehalf.rs b/net/src/conn/writehalf.rs index 6f0ea51..525254e 100644 --- a/net/src/conn/writehalf.rs +++ b/net/src/conn/writehalf.rs @@ -1,4 +1,3 @@ -#[cfg(feature = "packet")] use crate::encoding::Encoder; use crate::{encoding::EncodedData, packing::Compression, writer::Writer}; use futures_lite::AsyncWrite; @@ -46,7 +45,6 @@ where } } -#[cfg(feature = "packet")] impl WriteHalf where W: AsyncWrite + Unpin, diff --git a/net/src/encoding.rs b/net/src/encoding.rs index a006c17..6616218 100644 --- a/net/src/encoding.rs +++ b/net/src/encoding.rs @@ -1,4 +1,3 @@ -#[cfg(feature = "encoding")] use { crate::helpers::varint_vec, miners_encoding::{decode, encode, Decode, Encode}, @@ -45,7 +44,6 @@ impl<'encoded> EncodedData<'encoded> { pub unsafe fn from_raw(raw: &mut Vec) -> EncodedData { EncodedData(raw) } - #[cfg(feature = "encoding")] pub fn to_packet(&self) -> decode::Result<(i32, &[u8])> { let mut cursor = std::io::Cursor::new(&self.0[1..]); @@ -54,7 +52,6 @@ impl<'encoded> EncodedData<'encoded> { Ok((id, &self.0[pos + 1..])) } - #[cfg(feature = "encoding")] pub fn into_packet(self) -> decode::Result<(i32, &'encoded [u8])> { let mut cursor = std::io::Cursor::new(&self.0[1..]); @@ -96,7 +93,6 @@ impl<'encoded> EncodedData<'encoded> { #[derive(Default)] pub struct Encoder { - #[cfg_attr(not(feature = "encoding"), allow(unused))] encodebuf: Vec, } impl From> for Encoder { @@ -110,7 +106,6 @@ impl Encoder { } } impl Encoder { - #[cfg(feature = "encoding")] pub fn encode(&mut self, id: i32, data: impl Encode) -> encode::Result { self.encodebuf.clear(); self.encodebuf.push(0); @@ -118,7 +113,6 @@ impl Encoder { data.encode(&mut self.encodebuf)?; Ok(EncodedData(&mut self.encodebuf)) } - #[cfg(feature = "packet")] pub fn encode_packet

( &mut self, version: miners_version::ProtocolVersion, diff --git a/net/src/writer.rs b/net/src/writer.rs index 082afbe..d68a43d 100644 --- a/net/src/writer.rs +++ b/net/src/writer.rs @@ -2,7 +2,6 @@ use std::io; use futures_lite::{AsyncWrite, AsyncWriteExt}; -#[cfg(feature = "workpool")] use crate::DEFAULT_UNBLOCK_THRESHOLD; use crate::{ helpers::{encrypt, varint_slice},