Private
Public Access
1
0

fix all warnings

This commit is contained in:
2025-06-16 19:25:24 -07:00
parent 9d591dffc5
commit 75fe4d4608
8 changed files with 18 additions and 110 deletions

View File

@@ -86,19 +86,10 @@ impl From<tungstenite::Error> for Error {
}
trait AuthBuilder {
fn with_auth(self, token: &Option<JwtToken>) -> Self;
fn with_auth_string(self, token: &Option<String>) -> Self;
}
impl AuthBuilder for hyper::http::request::Builder {
fn with_auth(self, token: &Option<JwtToken>) -> Self {
if let Some(token) = &token {
self.header("Authorization", token.to_header_value())
} else {
self
}
}
fn with_auth_string(self, token: &Option<String>) -> Self {
if let Some(token) = &token {
self.header("Authorization", format!("Bearer: {}", token))
@@ -223,7 +214,7 @@ impl Stream for ResponseStream {
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
self.body
.poll_next_unpin(cx)
.map_err(|e| Error::HTTPError(e))
.map_err(Error::HTTPError)
}
}
@@ -310,7 +301,7 @@ impl<K: AuthenticationStore + Send + Sync> APIInterface for HTTPAPIClient<K> {
async fn fetch_attachment_data(
&mut self,
guid: &String,
guid: &str,
preview: bool,
) -> Result<ResponseStream, Self::Error> {
let endpoint = format!("attachment?guid={}&preview={}", guid, preview);
@@ -324,7 +315,7 @@ impl<K: AuthenticationStore + Send + Sync> APIInterface for HTTPAPIClient<K> {
&mut self,
mut data: tokio::io::BufReader<R>,
filename: &str,
size: u64,
_size: u64,
) -> Result<String, Self::Error>
where
R: tokio::io::AsyncRead + Unpin + Send + Sync + 'static,

View File

@@ -47,7 +47,7 @@ pub trait APIInterface {
// (GET) /attachment
async fn fetch_attachment_data(
&mut self,
guid: &String,
guid: &str,
preview: bool,
) -> Result<Self::ResponseStream, Self::Error>;