Skip to content

Commit ea6d002

Browse files
committed
refactor: remove dead code
1 parent b81d63b commit ea6d002

15 files changed

Lines changed: 20 additions & 25 deletions

File tree

common/src/filter.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,13 @@ impl LeafMatcher {
135135
}
136136
}
137137

138-
#[derive(Debug, Clone, Serialize, Deserialize)]
138+
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
139139
#[serde(deny_unknown_fields)]
140140
#[serde(untagged)]
141141
enum AddrListMatcherBuilder {
142142
Many(Vec<AddrMatcherBuilder>),
143143
Single(AddrMatcherBuilder),
144+
#[default]
144145
Any,
145146
}
146147
impl AddrListMatcherBuilder {
@@ -157,11 +158,6 @@ impl AddrListMatcherBuilder {
157158
})
158159
}
159160
}
160-
impl Default for AddrListMatcherBuilder {
161-
fn default() -> Self {
162-
Self::Any
163-
}
164-
}
165161

166162
#[derive(Debug, Clone)]
167163
enum AddrListMatcher {
@@ -233,12 +229,13 @@ impl AddrMatcher {
233229
}
234230
}
235231

236-
#[derive(Debug, Clone, Serialize, Deserialize)]
232+
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
237233
#[serde(deny_unknown_fields)]
238234
#[serde(untagged)]
239235
enum PortListMatcherBuilder {
240236
Many(Vec<PortMatcherBuilder>),
241237
Single(PortMatcherBuilder),
238+
#[default]
242239
Any,
243240
}
244241
impl PortListMatcherBuilder {
@@ -255,11 +252,6 @@ impl PortListMatcherBuilder {
255252
}
256253
}
257254
}
258-
impl Default for PortListMatcherBuilder {
259-
fn default() -> Self {
260-
Self::Any
261-
}
262-
}
263255

264256
#[derive(Debug, Clone, Serialize, Deserialize)]
265257
#[serde(deny_unknown_fields)]

common/src/notify.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ pub struct Waiter {
1414
waiters: Arc<Mutex<Waiters>>,
1515
}
1616
impl Waiter {
17+
pub fn has_notified(&self) -> bool {
18+
!self.event.is_empty()
19+
}
1720
pub async fn notified(&mut self) {
1821
self.event.recv().await.unwrap();
1922
}

common/src/proto/client/stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::{
1414
use ae::anti_replay::ValidatorRef;
1515
use metrics::counter;
1616
use thiserror::Error;
17-
use tracing::{error, instrument, trace};
17+
use tracing::{instrument, trace};
1818

1919
const IO_TIMEOUT: Duration = Duration::from_secs(60);
2020

common/src/proto/client/udp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use metrics::counter;
2929
use primitive::arena::obj_pool::ArcObjPool;
3030
use thiserror::Error;
3131
use tokio::net::UdpSocket;
32-
use tracing::{error, instrument, trace, warn};
32+
use tracing::{instrument, trace, warn};
3333

3434
#[derive(Debug)]
3535
pub struct UdpProxyClient {

common/src/proto/conn_handler/stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::{
1717
use async_speed_limit::Limiter;
1818
use serde::Deserialize;
1919
use thiserror::Error;
20-
use tracing::{error, info, instrument, warn};
20+
use tracing::{info, instrument, warn};
2121

2222
const IO_TIMEOUT: Duration = Duration::from_secs(60);
2323

common/src/proto/conn_handler/udp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use crate::{
2222
use async_speed_limit::Limiter;
2323
use thiserror::Error;
2424
use tokio::net::{ToSocketAddrs, UdpSocket};
25-
use tracing::{error, instrument, trace, warn};
25+
use tracing::{instrument, trace, warn};
2626
use udp_listener::{Conn, ConnWrite};
2727

2828
use super::ListenerBindError;

common/src/udp/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::time::Duration;
22

33
use thiserror::Error;
4-
use tracing::error;
54

65
pub mod respond;
76
pub mod server;

protocol/src/socks5/server/tcp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use common::{
2727
use serde::{Deserialize, Serialize};
2828
use thiserror::Error;
2929
use tokio::io::AsyncReadExt;
30-
use tracing::{error, trace, warn};
30+
use tracing::{trace, warn};
3131

3232
use crate::socks5::messages::{
3333
Command, MethodIdentifier, NegotiationRequest, NegotiationResponse, RelayRequest,

protocol/src/socks5/server/udp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use common::{
2020
use serde::{Deserialize, Serialize};
2121
use thiserror::Error;
2222
use tokio::net::{ToSocketAddrs, UdpSocket};
23-
use tracing::{error, warn};
23+
use tracing::warn;
2424
use udp_listener::Conn;
2525

2626
use crate::socks5::messages::UdpRequestHeader;

protocol/src/stream/streams/http_tunnel/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use monitor_table::table::RowOwnedGuard;
4040
use serde::{Deserialize, Serialize};
4141
use thiserror::Error;
4242
use tokio::io::{AsyncRead, AsyncWrite};
43-
use tracing::{error, info, instrument, trace, warn};
43+
use tracing::{info, instrument, trace, warn};
4444

4545
#[derive(Debug, Clone, Serialize, Deserialize)]
4646
#[serde(deny_unknown_fields)]

0 commit comments

Comments
 (0)