clippy
This commit is contained in:
@@ -1,22 +1,15 @@
|
||||
extern crate hyper;
|
||||
extern crate serde;
|
||||
|
||||
use std::{path::PathBuf, str::FromStr, str};
|
||||
use log::{info, warn, error, trace};
|
||||
use std::{path::PathBuf, str};
|
||||
use log::{error};
|
||||
|
||||
use hyper::{Body, Client, Method, Request, Uri, body};
|
||||
|
||||
use tower_hyper::client::Client as TowerClient;
|
||||
use tower_http::{
|
||||
trace::TraceLayer,
|
||||
classify::StatusInRangeAsFailures,
|
||||
};
|
||||
use tower::{ServiceBuilder, Service};
|
||||
use hyper::{Body, Client, Method, Request, Uri};
|
||||
use tower::{ServiceBuilder};
|
||||
|
||||
use async_trait::async_trait;
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde_json::Error as SerdeError;
|
||||
use serde_plain::{Deserializer, derive_deserialize_from_fromstr};
|
||||
|
||||
use crate::{APIInterface, model::Conversation};
|
||||
|
||||
type HttpClient = Client<hyper::client::HttpConnector>;
|
||||
@@ -63,12 +56,12 @@ impl APIInterface for HTTPClient {
|
||||
|
||||
impl HTTPClient {
|
||||
pub fn new(base_url: Uri) -> HTTPClient {
|
||||
let mut client = ServiceBuilder::new()
|
||||
let client = ServiceBuilder::new()
|
||||
.service(Client::new());
|
||||
|
||||
HTTPClient {
|
||||
base_url: base_url,
|
||||
client: client,
|
||||
base_url,
|
||||
client,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,6 +160,6 @@ mod test {
|
||||
|
||||
let client = local_mock_client();
|
||||
let conversations = client.get_conversations().await.unwrap();
|
||||
assert!(conversations.len() > 0);
|
||||
assert!(!conversations.is_empty());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ impl ConversationBuilder {
|
||||
date: self.date.unwrap_or(OffsetDateTime::now_utc()),
|
||||
unread_count: self.unread_count.unwrap_or(0),
|
||||
last_message_preview: self.last_message_preview,
|
||||
participant_display_names: self.participant_display_names.unwrap_or(vec![]),
|
||||
participant_display_names: self.participant_display_names.unwrap_or_default(),
|
||||
display_name: self.display_name,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user