client: Fix clippy warnings.
parent
49a24b6305
commit
63e0191f57
|
@ -193,7 +193,7 @@ impl AsyncClient {
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
let homeserver: Url = match homeserver_url.try_into() {
|
let homeserver: Url = match homeserver_url.try_into() {
|
||||||
Ok(u) => u,
|
Ok(u) => u,
|
||||||
Err(e) => panic!("Error parsing homeserver url"),
|
Err(_e) => panic!("Error parsing homeserver url"),
|
||||||
};
|
};
|
||||||
|
|
||||||
let http_client = reqwest::Client::builder();
|
let http_client = reqwest::Client::builder();
|
||||||
|
|
|
@ -47,10 +47,10 @@ impl Room {
|
||||||
///
|
///
|
||||||
/// * `room_id` - The unique id of the room.
|
/// * `room_id` - The unique id of the room.
|
||||||
/// * `own_user_id` - The mxid of our own user.
|
/// * `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 {
|
||||||
room_id: room_id.to_string(),
|
room_id: room_id.to_string(),
|
||||||
own_user_id: own_user_id.clone(),
|
own_user_id: own_user_id.to_owned(),
|
||||||
creator: None,
|
creator: None,
|
||||||
members: HashMap::new(),
|
members: HashMap::new(),
|
||||||
typing_users: Vec::new(),
|
typing_users: Vec::new(),
|
||||||
|
@ -196,7 +196,8 @@ impl Client {
|
||||||
self.session = Some(session);
|
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
|
self.joined_rooms
|
||||||
.entry(room_id.to_string())
|
.entry(room_id.to_string())
|
||||||
.or_insert(Arc::new(RwLock::new(Room::new(
|
.or_insert(Arc::new(RwLock::new(Room::new(
|
||||||
|
@ -221,7 +222,7 @@ impl Client {
|
||||||
/// otherwise.
|
/// otherwise.
|
||||||
pub fn receive_joined_timeline_event(
|
pub fn receive_joined_timeline_event(
|
||||||
&mut self,
|
&mut self,
|
||||||
room_id: &RoomId,
|
room_id: &str,
|
||||||
event: &EventResult<RoomEvent>,
|
event: &EventResult<RoomEvent>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
match event {
|
match event {
|
||||||
|
|
|
@ -18,7 +18,6 @@ impl Display for Error {
|
||||||
let message = match self.0 {
|
let message = match self.0 {
|
||||||
InnerError::AuthenticationRequired => "The queried endpoint requires authentication but was called with an anonymous client.",
|
InnerError::AuthenticationRequired => "The queried endpoint requires authentication but was called with an anonymous client.",
|
||||||
InnerError::Reqwest(_) => "An HTTP error occurred.",
|
InnerError::Reqwest(_) => "An HTTP error occurred.",
|
||||||
InnerError::ConfigurationError(_) => "Error configuring the client",
|
|
||||||
InnerError::Uri(_) => "Provided string could not be converted into a URI.",
|
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::RumaApi(_) => "An error occurred converting between ruma_client_api and hyper types.",
|
||||||
InnerError::SerdeJson(_) => "A serialization error occurred.",
|
InnerError::SerdeJson(_) => "A serialization error occurred.",
|
||||||
|
@ -36,8 +35,6 @@ impl StdError for Error {}
|
||||||
pub(crate) enum InnerError {
|
pub(crate) enum InnerError {
|
||||||
/// Queried endpoint requires authentication but was called on an anonymous client.
|
/// Queried endpoint requires authentication but was called on an anonymous client.
|
||||||
AuthenticationRequired,
|
AuthenticationRequired,
|
||||||
/// An error in the client configuration.
|
|
||||||
ConfigurationError(String),
|
|
||||||
/// An error at the HTTP layer.
|
/// An error at the HTTP layer.
|
||||||
Reqwest(ReqwestError),
|
Reqwest(ReqwestError),
|
||||||
/// An error when parsing a string as a URI.
|
/// An error when parsing a string as a URI.
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
//! Crate `nio-client` is a [Matrix](https://matrix.org/) client library.
|
//! This crate implements a [Matrix](https://matrix.org/) client library.
|
||||||
//!
|
#![deny(missing_docs)]
|
||||||
#![warn(missing_docs)]
|
|
||||||
|
|
||||||
pub use crate::{error::Error, session::Session};
|
pub use crate::{error::Error, session::Session};
|
||||||
pub use reqwest::header::InvalidHeaderValue;
|
pub use reqwest::header::InvalidHeaderValue;
|
||||||
|
|
Loading…
Reference in New Issue