mirror of https://github.com/fafhrd91/actix-net
chore(*): fix clippy warnings (#813)
This commit is contained in:
parent
22f98ec136
commit
c347906c78
|
|
@ -172,7 +172,7 @@ impl Arbiter {
|
||||||
let system_id = sys.id();
|
let system_id = sys.id();
|
||||||
let arb_id = COUNT.fetch_add(1, Ordering::Relaxed);
|
let arb_id = COUNT.fetch_add(1, Ordering::Relaxed);
|
||||||
|
|
||||||
let name = format!("actix-rt|system:{}|arbiter:{}", system_id, arb_id);
|
let name = format!("actix-rt|system:{system_id}|arbiter:{arb_id}");
|
||||||
let (tx, rx) = mpsc::unbounded_channel();
|
let (tx, rx) = mpsc::unbounded_channel();
|
||||||
|
|
||||||
let (ready_tx, ready_rx) = std::sync::mpsc::channel::<()>();
|
let (ready_tx, ready_rx) = std::sync::mpsc::channel::<()>();
|
||||||
|
|
|
||||||
|
|
@ -224,9 +224,10 @@ impl WorkerService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||||
enum WorkerServiceStatus {
|
enum WorkerServiceStatus {
|
||||||
Available,
|
Available,
|
||||||
|
#[default]
|
||||||
Unavailable,
|
Unavailable,
|
||||||
Failed,
|
Failed,
|
||||||
Restarting,
|
Restarting,
|
||||||
|
|
@ -234,12 +235,6 @@ enum WorkerServiceStatus {
|
||||||
Stopped,
|
Stopped,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for WorkerServiceStatus {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Unavailable
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Config for worker behavior passed down from server builder.
|
/// Config for worker behavior passed down from server builder.
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub(crate) struct ServerWorkerConfig {
|
pub(crate) struct ServerWorkerConfig {
|
||||||
|
|
@ -543,8 +538,10 @@ impl ServerWorker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
enum WorkerState {
|
enum WorkerState {
|
||||||
Available,
|
Available,
|
||||||
|
#[default]
|
||||||
Unavailable,
|
Unavailable,
|
||||||
Restarting(Restart),
|
Restarting(Restart),
|
||||||
Shutdown(Shutdown),
|
Shutdown(Shutdown),
|
||||||
|
|
@ -568,12 +565,6 @@ struct Shutdown {
|
||||||
tx: oneshot::Sender<bool>,
|
tx: oneshot::Sender<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for WorkerState {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Unavailable
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Drop for ServerWorker {
|
impl Drop for ServerWorker {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
Arbiter::try_current().as_ref().map(ArbiterHandle::stop);
|
Arbiter::try_current().as_ref().map(ArbiterHandle::stop);
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,9 @@ use std::{
|
||||||
net::SocketAddr,
|
net::SocketAddr,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
#[derive(Debug, Clone, Eq, PartialEq, Hash, Default)]
|
||||||
pub(crate) enum ConnectAddrs {
|
pub(crate) enum ConnectAddrs {
|
||||||
|
#[default]
|
||||||
None,
|
None,
|
||||||
One(SocketAddr),
|
One(SocketAddr),
|
||||||
// TODO: consider using smallvec
|
// TODO: consider using smallvec
|
||||||
|
|
@ -22,12 +23,6 @@ impl ConnectAddrs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ConnectAddrs {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<Option<SocketAddr>> for ConnectAddrs {
|
impl From<Option<SocketAddr>> for ConnectAddrs {
|
||||||
fn from(addr: Option<SocketAddr>) -> Self {
|
fn from(addr: Option<SocketAddr>) -> Self {
|
||||||
match addr {
|
match addr {
|
||||||
|
|
|
||||||
|
|
@ -49,23 +49,18 @@ impl<R: Host> ServiceFactory<ConnectInfo<R>> for Resolver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Default)]
|
||||||
enum ResolverKind {
|
enum ResolverKind {
|
||||||
/// Built-in DNS resolver.
|
/// Built-in DNS resolver.
|
||||||
///
|
///
|
||||||
/// See [`std::net::ToSocketAddrs`] trait.
|
/// See [`std::net::ToSocketAddrs`] trait.
|
||||||
|
#[default]
|
||||||
Default,
|
Default,
|
||||||
|
|
||||||
/// Custom, user-provided DNS resolver.
|
/// Custom, user-provided DNS resolver.
|
||||||
Custom(Rc<dyn Resolve>),
|
Custom(Rc<dyn Resolve>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ResolverKind {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Default
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// DNS resolver service.
|
/// DNS resolver service.
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct ResolverService {
|
pub struct ResolverService {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue