base: Add some missing debug implementations and add more strict lints.

master
Damir Jelić 2020-05-13 12:34:46 +02:00
parent 8a401d23e2
commit a8f94e2329
4 changed files with 22 additions and 1 deletions

View File

@ -61,6 +61,7 @@ use matrix_sdk_crypto::{OlmMachine, OneTimeKeys};
pub type Token = String;
/// Signals to the `BaseClient` which `RoomState` to send to `EventEmitter`.
#[derive(Debug)]
pub enum RoomStateType {
/// Represents a joined room, the `joined_rooms` HashMap will be used.
Joined,
@ -75,6 +76,7 @@ pub enum RoomStateType {
/// If the event came from the `join`, `invite` or `leave` rooms map from the server
/// the variant that holds the corresponding room is used. `RoomState` is generic
/// so it can be used to represent a `Room` or an `Arc<RwLock<Room>>`
#[derive(Debug)]
pub enum RoomState<R> {
/// A room from the `join` section of a sync response.
Joined(R),

View File

@ -24,7 +24,16 @@
//! keys. If this is disabled and `encryption` support is enabled the keys will
//! by default be stored only in memory and thus lost after the client is
//! destroyed.
#![deny(missing_docs)]
#![deny(
missing_debug_implementations,
dead_code,
missing_docs,
trivial_casts,
trivial_numeric_casts,
unused_extern_crates,
unused_import_braces,
unused_qualifications
)]
pub use crate::{error::Error, error::Result, session::Session};
pub use matrix_sdk_common::*;

View File

@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::fmt;
use std::fs;
use std::path::{Path, PathBuf};
use std::sync::{
@ -39,6 +40,14 @@ impl JsonStore {
}
}
impl fmt::Debug for JsonStore {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("JsonStore")
.field("path", &self.path)
.finish()
}
}
#[async_trait::async_trait]
impl StateStore for JsonStore {
async fn load_client_state(&self, sess: &Session) -> Result<Option<ClientState>> {

View File

@ -68,6 +68,7 @@ impl ClientState {
/// `JsonStore::load_all_rooms` returns `AllRooms`.
///
/// `AllRooms` is made of the `joined`, `invited` and `left` room maps.
#[derive(Debug)]
pub struct AllRooms {
/// The joined room mapping of `RoomId` to `Room`.
pub joined: HashMap<RoomId, Room>,