client: Fix clippy warnings.

master
Damir Jelić 2020-02-21 14:29:46 +01:00
parent 49a24b6305
commit 63e0191f57
4 changed files with 8 additions and 11 deletions

View File

@ -193,7 +193,7 @@ impl AsyncClient {
) -> Result<Self, Error> {
let homeserver: Url = match homeserver_url.try_into() {
Ok(u) => u,
Err(e) => panic!("Error parsing homeserver url"),
Err(_e) => panic!("Error parsing homeserver url"),
};
let http_client = reqwest::Client::builder();

View File

@ -47,10 +47,10 @@ impl Room {
///
/// * `room_id` - The unique id of the room.
/// * `own_user_id` - The mxid of our own user.
pub fn new(room_id: &str, own_user_id: &UserId) -> Self {
pub fn new(room_id: &str, own_user_id: &str) -> Self {
Room {
room_id: room_id.to_string(),
own_user_id: own_user_id.clone(),
own_user_id: own_user_id.to_owned(),
creator: None,
members: HashMap::new(),
typing_users: Vec::new(),
@ -196,7 +196,8 @@ impl Client {
self.session = Some(session);
}
fn get_or_create_room(&mut self, room_id: &RoomId) -> &mut Arc<RwLock<Room>> {
fn get_or_create_room(&mut self, room_id: &str) -> &mut Arc<RwLock<Room>> {
#[allow(clippy::or_fun_call)]
self.joined_rooms
.entry(room_id.to_string())
.or_insert(Arc::new(RwLock::new(Room::new(
@ -221,7 +222,7 @@ impl Client {
/// otherwise.
pub fn receive_joined_timeline_event(
&mut self,
room_id: &RoomId,
room_id: &str,
event: &EventResult<RoomEvent>,
) -> bool {
match event {

View File

@ -18,7 +18,6 @@ impl Display for Error {
let message = match self.0 {
InnerError::AuthenticationRequired => "The queried endpoint requires authentication but was called with an anonymous client.",
InnerError::Reqwest(_) => "An HTTP error occurred.",
InnerError::ConfigurationError(_) => "Error configuring the client",
InnerError::Uri(_) => "Provided string could not be converted into a URI.",
InnerError::RumaApi(_) => "An error occurred converting between ruma_client_api and hyper types.",
InnerError::SerdeJson(_) => "A serialization error occurred.",
@ -36,8 +35,6 @@ impl StdError for Error {}
pub(crate) enum InnerError {
/// Queried endpoint requires authentication but was called on an anonymous client.
AuthenticationRequired,
/// An error in the client configuration.
ConfigurationError(String),
/// An error at the HTTP layer.
Reqwest(ReqwestError),
/// An error when parsing a string as a URI.

View File

@ -1,6 +1,5 @@
//! Crate `nio-client` is a [Matrix](https://matrix.org/) client library.
//!
#![warn(missing_docs)]
//! This crate implements a [Matrix](https://matrix.org/) client library.
#![deny(missing_docs)]
pub use crate::{error::Error, session::Session};
pub use reqwest::header::InvalidHeaderValue;