cargo fmt

This commit is contained in:
George Hahn 2024-06-06 21:37:26 -06:00
parent da0deb1de6
commit e1113dd5e2
3 changed files with 9 additions and 12 deletions

View file

@ -7,10 +7,10 @@ use std::{
use bytes::Bytes; use bytes::Bytes;
use futures_util::StreamExt; use futures_util::StreamExt;
use http_body_util::BodyExt;
use hyper::StatusCode; use hyper::StatusCode;
use tempfile::NamedTempFile; use tempfile::NamedTempFile;
use tokio::sync::{mpsc, oneshot}; use tokio::sync::{mpsc, oneshot};
use http_body_util::BodyExt;
use librespot_core::{http_client::HttpClient, session::Session, Error}; use librespot_core::{http_client::HttpClient, session::Session, Error};

View file

@ -11,12 +11,13 @@ use governor::{
}; };
use http::{header::HeaderValue, Uri}; use http::{header::HeaderValue, Uri};
use http_body_util::{BodyExt, Full}; use http_body_util::{BodyExt, Full};
use hyper::{ use hyper::{body::Incoming, header::USER_AGENT, HeaderMap, Request, Response, StatusCode};
body::Incoming, header::USER_AGENT, HeaderMap, Request, Response, StatusCode
};
use hyper_proxy2::{Intercept, Proxy, ProxyConnector}; use hyper_proxy2::{Intercept, Proxy, ProxyConnector};
use hyper_rustls::{HttpsConnector, HttpsConnectorBuilder}; use hyper_rustls::{HttpsConnector, HttpsConnectorBuilder};
use hyper_util::{client::legacy::{connect::HttpConnector, Client, ResponseFuture}, rt::TokioExecutor}; use hyper_util::{
client::legacy::{connect::HttpConnector, Client, ResponseFuture},
rt::TokioExecutor,
};
use nonzero_ext::nonzero; use nonzero_ext::nonzero;
use once_cell::sync::OnceCell; use once_cell::sync::OnceCell;
use parking_lot::Mutex; use parking_lot::Mutex;
@ -249,7 +250,6 @@ impl HttpClient {
)) ))
})?; })?;
Ok(self.hyper_client()?.request(req.map(Full::new))) Ok(self.hyper_client()?.request(req.map(Full::new)))
} }

View file

@ -16,9 +16,7 @@ use futures_core::Stream;
use futures_util::{FutureExt, TryFutureExt}; use futures_util::{FutureExt, TryFutureExt};
use hmac::{Hmac, Mac}; use hmac::{Hmac, Mac};
use http_body_util::{BodyExt, Full}; use http_body_util::{BodyExt, Full};
use hyper::{ use hyper::{body::Incoming, Method, Request, Response, StatusCode};
body::Incoming, Method, Request, Response, StatusCode
};
use hyper_util::{rt::TokioIo, server::graceful::GracefulShutdown}; use hyper_util::{rt::TokioIo, server::graceful::GracefulShutdown};
use log::{debug, error, warn}; use log::{debug, error, warn};
@ -246,7 +244,7 @@ impl DiscoveryServer {
pub fn new(config: Config, port: &mut u16) -> Result<Self, Error> { pub fn new(config: Config, port: &mut u16) -> Result<Self, Error> {
let (discovery, cred_rx) = RequestHandler::new(config); let (discovery, cred_rx) = RequestHandler::new(config);
let address = SocketAddr::new(Ipv4Addr::UNSPECIFIED.into(), *port); let address = SocketAddr::new(Ipv4Addr::UNSPECIFIED.into(), *port);
let (close_tx, close_rx) = oneshot::channel(); let (close_tx, close_rx) = oneshot::channel();
let listener = match TcpListener::bind(address) { let listener = match TcpListener::bind(address) {
@ -271,10 +269,9 @@ impl DiscoveryServer {
} }
} }
tokio::spawn(async move { tokio::spawn(async move {
let discovery = Arc::new(discovery); let discovery = Arc::new(discovery);
let server = hyper::server::conn::http1::Builder::new(); let server = hyper::server::conn::http1::Builder::new();
let graceful = GracefulShutdown::new(); let graceful = GracefulShutdown::new();
let mut close_rx = std::pin::pin!(close_rx); let mut close_rx = std::pin::pin!(close_rx);