diff --git a/src/api_client/mod.rs b/src/api_client/mod.rs index 32fe237..f5378c1 100644 --- a/src/api_client/mod.rs +++ b/src/api_client/mod.rs @@ -234,21 +234,9 @@ impl AuthenticatedCVR { /// /// # Errors /// - /// If deserializing user agent fails. - #[cfg(feature = "http_client")] - pub fn downgrade(self) -> Result { - Ok(UnauthenticatedCVR { - http: UnauthenticatedCVR::http_client(&self.config.user_agent)?, - http_rate_limiter: self.http_rate_limiter, - config: self.config, - }) - } - - /// Creates a new authenticated CVR API client + /// If deserializing user agent fails.# Panics /// - /// # Errors - /// - /// If deserializing user agent into a header fails + /// If there's an internal programming error, aka should never panic.ails pub fn new( config: ApiConfiguration, auth: impl Into + Send, ) -> Result { @@ -306,12 +294,19 @@ impl AuthenticatedCVR { lock.is_some() } + // Clippy seems to be wrong, or at least haven't been able to figure out how + // this could be cleaned up more... + #[allow(clippy::significant_drop_tightening)] /// Sends a WS message to the CVR API. /// /// # Errors /// /// If something with the request failed, /// or if the WS connection wasn't already open and creating it failed. + /// + /// # Panics + /// + /// If there's an internal programming error, aka should never panic. #[cfg(feature = "ws_client")] pub async fn send( &self, @@ -336,12 +331,19 @@ impl AuthenticatedCVR { .send(requestable) } + // Clippy seems to be wrong, or at least haven't been able to figure out how + // this could be cleaned up more... + #[allow(clippy::significant_drop_tightening)] /// Listens to events from the WS connection /// /// # Errors /// /// If creating the client fails, /// or if the WS connection wasn't already open and creating it failed. + /// + /// # Panics + /// + /// If there's an internal programming error, aka should never panic. #[cfg(feature = "ws_client")] pub async fn listen(&self) -> Result { { diff --git a/src/api_client/ws.rs b/src/api_client/ws.rs index 7d4ccf0..8e6a643 100644 --- a/src/api_client/ws.rs +++ b/src/api_client/ws.rs @@ -13,7 +13,7 @@ pub type ReceiverContainer = pub struct Client { receive: ReceiverContainer, handle: JoinHandle<()>, - internal_client: ezsockets::Client, + internal: ezsockets::Client, } struct InternalClientExt { @@ -92,7 +92,7 @@ impl Client { internal_client.call(()).ok(); let ws_client = Self { - internal_client, + internal: internal_client, handle, receive: std::sync::Arc::new(tokio::sync::Mutex::new( UnboundedReceiverStream::from(received_receiver), @@ -115,10 +115,7 @@ impl Client { data: requestable, }; let data = serde_json::to_vec(&data)?; - self - .internal_client - .binary(data) - .map_err(|e| ApiError::WebSocket(Box::new(e)))?; + self.internal.binary(data).map_err(|e| ApiError::WebSocket(Box::new(e)))?; Ok(()) } diff --git a/src/model/mod.rs b/src/model/mod.rs index bd7ac93..3c0bd81 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -29,7 +29,7 @@ pub use categories::*; /// Seems like a lot if not all of the API calls are wrapped /// in a generic data/message struct. -#[cfg(any(feature = "http"))] +#[cfg(feature = "http")] #[serde_as] #[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] @@ -122,7 +122,7 @@ impl<'de> serde::Deserialize<'de> for WsResponseData { } } -#[cfg(any(feature = "http"))] +#[cfg(feature = "http")] #[serde_as] #[derive(Debug, Clone, PartialEq, Eq, Deserialize)] #[serde(rename_all = "camelCase")] diff --git a/src/query/users.rs b/src/query/users.rs index a0c8538..692a0a4 100644 --- a/src/query/users.rs +++ b/src/query/users.rs @@ -64,7 +64,7 @@ impl std::fmt::Debug for SavedLoginCredentials { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("SavedLoginCredentials") .field("username", &self.username) - .field("token", &"*****") + .field("access_key", &"*****") .finish() } }