Skip to content

Commit

Permalink
remove useless cargo features
Browse files Browse the repository at this point in the history
  • Loading branch information
comblock committed Feb 4, 2023
1 parent d0d004b commit 7ec2667
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
10 changes: 5 additions & 5 deletions net/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ 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 }
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"]
2 changes: 0 additions & 2 deletions net/src/conn/writehalf.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[cfg(feature = "packet")]
use crate::encoding::Encoder;
use crate::{encoding::EncodedData, packing::Compression, writer::Writer};
use futures_lite::AsyncWrite;
Expand Down Expand Up @@ -46,7 +45,6 @@ where
}
}

#[cfg(feature = "packet")]
impl<W> WriteHalf<W>
where
W: AsyncWrite + Unpin,
Expand Down
6 changes: 0 additions & 6 deletions net/src/encoding.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[cfg(feature = "encoding")]
use {
crate::helpers::varint_vec,
miners_encoding::{decode, encode, Decode, Encode},
Expand Down Expand Up @@ -45,7 +44,6 @@ impl<'encoded> EncodedData<'encoded> {
pub unsafe fn from_raw(raw: &mut Vec<u8>) -> 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..]);

Expand All @@ -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..]);

Expand Down Expand Up @@ -96,7 +93,6 @@ impl<'encoded> EncodedData<'encoded> {

#[derive(Default)]
pub struct Encoder {
#[cfg_attr(not(feature = "encoding"), allow(unused))]
encodebuf: Vec<u8>,
}
impl From<Vec<u8>> for Encoder {
Expand All @@ -110,15 +106,13 @@ impl Encoder {
}
}
impl Encoder {
#[cfg(feature = "encoding")]
pub fn encode(&mut self, id: i32, data: impl Encode) -> encode::Result<EncodedData> {
self.encodebuf.clear();
self.encodebuf.push(0);
varint_vec(id as u32, &mut self.encodebuf);
data.encode(&mut self.encodebuf)?;
Ok(EncodedData(&mut self.encodebuf))
}
#[cfg(feature = "packet")]
pub fn encode_packet<P>(
&mut self,
version: miners_version::ProtocolVersion,
Expand Down
1 change: 0 additions & 1 deletion net/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit 7ec2667

Please sign in to comment.