Add some more lints, and fix the compile errors they generate

master
Paul Woolcock 6 years ago
parent 4e5a2f5c51
commit 5b24922d9e
  1. 1
      src/entities/account.rs
  2. 2
      src/entities/instance.rs
  3. 1
      src/entities/itemsiter.rs
  4. 1
      src/entities/mention.rs
  5. 2
      src/entities/mod.rs
  6. 7
      src/entities/notification.rs
  7. 5
      src/http_send.rs
  8. 12
      src/lib.rs
  9. 1
      src/page.rs
  10. 2
      src/registration.rs

@ -82,6 +82,7 @@ fn string_or_bool<'de, D: Deserializer<'de>>(val: D) -> ::std::result::Result<bo
}) })
} }
#[derive(Debug)]
pub struct CredentialsBuilder<'a> { pub struct CredentialsBuilder<'a> {
display_name: Option<&'a str>, display_name: Option<&'a str>,
note: Option<&'a str>, note: Option<&'a str>,

@ -37,7 +37,7 @@ pub struct StreamingApi {
} }
/// Statistics about the Mastodon instance. /// Statistics about the Mastodon instance.
#[derive(Debug, Clone, Deserialize)] #[derive(Debug, Clone, Copy, Deserialize)]
pub struct Stats { pub struct Stats {
user_count: u64, user_count: u64,
status_count: u64, status_count: u64,

@ -24,6 +24,7 @@ use serde::Deserialize;
/// # Ok(()) /// # Ok(())
/// # } /// # }
/// ``` /// ```
#[derive(Debug, Clone)]
pub(crate) struct ItemsIter<'a, T: Clone + for<'de> Deserialize<'de>, H: 'a + HttpSend> { pub(crate) struct ItemsIter<'a, T: Clone + for<'de> Deserialize<'de>, H: 'a + HttpSend> {
page: Page<'a, T, H>, page: Page<'a, T, H>,
buffer: Vec<T>, buffer: Vec<T>,

@ -1,3 +1,4 @@
#[derive(Debug, Clone)]
pub struct Mention { pub struct Mention {
/// URL of user's profile (can be remote) /// URL of user's profile (can be remote)
pub url: String, pub url: String,

@ -13,7 +13,7 @@ pub mod search_result;
pub mod status; pub mod status;
/// An empty JSON object. /// An empty JSON object.
#[derive(Deserialize)] #[derive(Deserialize, Debug, Copy, Clone, PartialEq)]
pub struct Empty {} pub struct Empty {}
pub mod prelude { pub mod prelude {

@ -20,18 +20,15 @@ pub struct Notification {
} }
/// The type of notification. /// The type of notification.
#[derive(Debug, Clone, Deserialize)] #[derive(Debug, Clone, Copy, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum NotificationType { pub enum NotificationType {
/// Someone mentioned the application client in another status. /// Someone mentioned the application client in another status.
#[serde(rename = "mention")]
Mention, Mention,
/// Someone reblogged one of the application client's statuses. /// Someone reblogged one of the application client's statuses.
#[serde(rename = "reblog")]
Reblog, Reblog,
/// Someone favourited one of the application client's statuses. /// Someone favourited one of the application client's statuses.
#[serde(rename = "favourite")]
Favourite, Favourite,
/// Someone followed the application client. /// Someone followed the application client.
#[serde(rename = "follow")]
Follow, Follow,
} }

@ -1,7 +1,8 @@
use reqwest::{Client, Request, RequestBuilder, Response}; use reqwest::{Client, Request, RequestBuilder, Response};
use std::fmt::Debug;
use Result; use Result;
pub trait HttpSend: Clone { pub trait HttpSend: Clone + Debug {
fn execute(&self, client: &Client, request: Request) -> Result<Response>; fn execute(&self, client: &Client, request: Request) -> Result<Response>;
fn send(&self, client: &Client, builder: &mut RequestBuilder) -> Result<Response> { fn send(&self, client: &Client, builder: &mut RequestBuilder) -> Result<Response> {
let request = builder.build()?; let request = builder.build()?;
@ -9,7 +10,7 @@ pub trait HttpSend: Clone {
} }
} }
#[derive(Clone)] #[derive(Clone, Copy, Debug, PartialEq)]
pub struct HttpSender; pub struct HttpSender;
impl HttpSend for HttpSender { impl HttpSend for HttpSender {

@ -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))] #![cfg_attr(test, deny(missing_docs))]
#[macro_use] #[macro_use]

@ -9,6 +9,7 @@ use url::Url;
use http_send::HttpSend; use http_send::HttpSend;
#[derive(Debug, Clone)]
pub struct Page<'a, T: for<'de> Deserialize<'de>, H: 'a + HttpSend> { pub struct Page<'a, T: for<'de> Deserialize<'de>, H: 'a + HttpSend> {
mastodon: &'a Mastodon<H>, mastodon: &'a Mastodon<H>,
next: Option<Url>, next: Option<Url>,

@ -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 /// Handles registering your mastodon app to your instance. It is recommended
/// you cache your data struct to avoid registering on every run. /// you cache your data struct to avoid registering on every run.
#[derive(Debug, Clone)]
pub struct Registration<'a, H: HttpSend = HttpSender> { pub struct Registration<'a, H: HttpSend = HttpSender> {
base: String, base: String,
client: Client, client: Client,
@ -215,6 +216,7 @@ impl<H: HttpSend> Registered<H> {
} }
} }
#[derive(Debug, Clone)]
pub struct Registered<H: HttpSend> { pub struct Registered<H: HttpSend> {
base: String, base: String,
client: Client, client: Client,

Loading…
Cancel
Save