remove deref impl

This commit is contained in:
Conrad Ludgate
2024-09-26 15:51:55 +01:00
parent 249f5ea17d
commit 5687384a8e
2 changed files with 8 additions and 34 deletions

View File

@@ -4,11 +4,7 @@ use hyper_util::rt::{TokioExecutor, TokioIo};
use parking_lot::RwLock;
use rand::Rng;
use std::collections::VecDeque;
use std::ops::DerefMut;
use std::{
ops::Deref,
sync::atomic::{self, AtomicUsize},
};
use std::sync::atomic::{self, AtomicUsize};
use std::{sync::Arc, sync::Weak};
use tokio::net::TcpStream;
@@ -320,17 +316,8 @@ pub(crate) fn poll_http2_client(
Client::new(client, aux)
}
impl Client {
pub(crate) fn metrics(&self) -> Arc<MetricCounter> {
USAGE_METRICS.register(Ids {
endpoint_id: self.aux.endpoint_id,
branch_id: self.aux.branch_id,
})
}
}
pub(crate) struct Client {
inner: Send,
pub(crate) inner: Send,
aux: MetricsAuxInfo,
}
@@ -338,17 +325,11 @@ impl Client {
pub(self) fn new(inner: Send, aux: MetricsAuxInfo) -> Self {
Self { inner, aux }
}
}
impl DerefMut for Client {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
impl Deref for Client {
type Target = Send;
fn deref(&self) -> &Self::Target {
&self.inner
pub(crate) fn metrics(&self) -> Arc<MetricCounter> {
USAGE_METRICS.register(Ids {
endpoint_id: self.aux.endpoint_id,
branch_id: self.aux.branch_id,
})
}
}

View File

@@ -757,14 +757,6 @@ async fn handle_auth_broker_inner(
let mut client = backend.connect_to_local_proxy(ctx, conn_info).await?;
// always completes instantly in http2 mode
// but good just in case
client
.ready()
.await
.map_err(LocalProxyConnError::from)
.map_err(HttpConnError::from)?;
let local_proxy_uri = ::http::Uri::from_static("http://proxy.local/sql");
let (mut parts, body) = request.into_parts();
@@ -786,6 +778,7 @@ async fn handle_auth_broker_inner(
let _metrics = client.metrics();
Ok(client
.inner
.send_request(req)
.await
.map_err(LocalProxyConnError::from)