diff --git a/src/entities/account.rs b/src/entities/account.rs index 8cfa9a6..ba6f993 100644 --- a/src/entities/account.rs +++ b/src/entities/account.rs @@ -82,6 +82,7 @@ fn string_or_bool<'de, D: Deserializer<'de>>(val: D) -> ::std::result::Result { display_name: Option<&'a str>, note: Option<&'a str>, diff --git a/src/entities/instance.rs b/src/entities/instance.rs index 682cc87..0b1ce00 100644 --- a/src/entities/instance.rs +++ b/src/entities/instance.rs @@ -37,7 +37,7 @@ pub struct StreamingApi { } /// Statistics about the Mastodon instance. -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Copy, Deserialize)] pub struct Stats { user_count: u64, status_count: u64, diff --git a/src/entities/itemsiter.rs b/src/entities/itemsiter.rs index 648f844..96cd20e 100644 --- a/src/entities/itemsiter.rs +++ b/src/entities/itemsiter.rs @@ -24,6 +24,7 @@ use serde::Deserialize; /// # Ok(()) /// # } /// ``` +#[derive(Debug, Clone)] pub(crate) struct ItemsIter<'a, T: Clone + for<'de> Deserialize<'de>, H: 'a + HttpSend> { page: Page<'a, T, H>, buffer: Vec, diff --git a/src/entities/mention.rs b/src/entities/mention.rs index 479a691..4f1126d 100644 --- a/src/entities/mention.rs +++ b/src/entities/mention.rs @@ -1,3 +1,4 @@ +#[derive(Debug, Clone)] pub struct Mention { /// URL of user's profile (can be remote) pub url: String, diff --git a/src/entities/mod.rs b/src/entities/mod.rs index 3d44f87..f7edd2a 100644 --- a/src/entities/mod.rs +++ b/src/entities/mod.rs @@ -13,7 +13,7 @@ pub mod search_result; pub mod status; /// An empty JSON object. -#[derive(Deserialize)] +#[derive(Deserialize, Debug, Copy, Clone, PartialEq)] pub struct Empty {} pub mod prelude { diff --git a/src/entities/notification.rs b/src/entities/notification.rs index 1fbd919..8f7759b 100644 --- a/src/entities/notification.rs +++ b/src/entities/notification.rs @@ -20,18 +20,15 @@ pub struct Notification { } /// The type of notification. -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Copy, Deserialize)] +#[serde(rename_all = "lowercase")] pub enum NotificationType { /// Someone mentioned the application client in another status. - #[serde(rename = "mention")] Mention, /// Someone reblogged one of the application client's statuses. - #[serde(rename = "reblog")] Reblog, /// Someone favourited one of the application client's statuses. - #[serde(rename = "favourite")] Favourite, /// Someone followed the application client. - #[serde(rename = "follow")] Follow, } diff --git a/src/http_send.rs b/src/http_send.rs index 56c69ef..52f0704 100644 --- a/src/http_send.rs +++ b/src/http_send.rs @@ -1,7 +1,8 @@ use reqwest::{Client, Request, RequestBuilder, Response}; +use std::fmt::Debug; use Result; -pub trait HttpSend: Clone { +pub trait HttpSend: Clone + Debug { fn execute(&self, client: &Client, request: Request) -> Result; fn send(&self, client: &Client, builder: &mut RequestBuilder) -> Result { let request = builder.build()?; @@ -9,7 +10,7 @@ pub trait HttpSend: Clone { } } -#[derive(Clone)] +#[derive(Clone, Copy, Debug, PartialEq)] pub struct HttpSender; impl HttpSend for HttpSender { diff --git a/src/lib.rs b/src/lib.rs index b7b9770..6297d2d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,7 +25,17 @@ //! # } //! ``` -#![cfg_attr(test, deny(warnings))] +#![deny( + warnings, + missing_debug_implementations, + missing_copy_implementations, + trivial_casts, + trivial_numeric_casts, + unsafe_code, + unstable_features, + unused_import_braces, + unused_qualifications +)] #![cfg_attr(test, deny(missing_docs))] #[macro_use] diff --git a/src/page.rs b/src/page.rs index 5df4f99..d9f1b43 100644 --- a/src/page.rs +++ b/src/page.rs @@ -9,6 +9,7 @@ use url::Url; use http_send::HttpSend; +#[derive(Debug, Clone)] pub struct Page<'a, T: for<'de> Deserialize<'de>, H: 'a + HttpSend> { mastodon: &'a Mastodon, next: Option, diff --git a/src/registration.rs b/src/registration.rs index 68f0498..647ddbf 100644 --- a/src/registration.rs +++ b/src/registration.rs @@ -15,6 +15,7 @@ const DEFAULT_REDIRECT_URI: &'static str = "urn:ietf:wg:oauth:2.0:oob"; /// Handles registering your mastodon app to your instance. It is recommended /// you cache your data struct to avoid registering on every run. +#[derive(Debug, Clone)] pub struct Registration<'a, H: HttpSend = HttpSender> { base: String, client: Client, @@ -215,6 +216,7 @@ impl Registered { } } +#[derive(Debug, Clone)] pub struct Registered { base: String, client: Client,