diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 31000a2..33f8bcb 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -20,3 +20,15 @@ jobs: run: cargo build --verbose - name: Run tests run: cargo test --verbose + + clippy: + needs: [build] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: 1.65.0 + components: clippy + - run: cargo clippy -- -D warnings + diff --git a/src/apps.rs b/src/apps.rs index b85321a..5b05cae 100644 --- a/src/apps.rs +++ b/src/apps.rs @@ -110,13 +110,13 @@ impl<'a> AppBuilder<'a> { Ok(App { client_name: self .client_name - .ok_or_else(|| Error::MissingField("client_name"))? + .ok_or(Error::MissingField("client_name"))? .into(), redirect_uris: self .redirect_uris .unwrap_or_else(|| "urn:ietf:wg:oauth:2.0:oob".into()) .into(), - scopes: self.scopes.unwrap_or_else(|| Scopes::read_all()), + scopes: self.scopes.unwrap_or_else(Scopes::read_all), website: self.website.map(|s| s.into()), }) } @@ -126,7 +126,7 @@ impl<'a> TryInto for AppBuilder<'a> { type Error = Error; fn try_into(self) -> Result { - Ok(self.build()?) + self.build() } } diff --git a/src/data.rs b/src/data.rs index 0861040..04699a7 100644 --- a/src/data.rs +++ b/src/data.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; /// Raw data about mastodon app. Save `Data` using `serde` to prevent needing /// to authenticate on every run. -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, Default)] +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize, Default)] pub struct Data { /// Base url of instance eg. `https://botsin.space`. pub base: Cow<'static, str>, diff --git a/src/entities/account.rs b/src/entities/account.rs index 002eb40..d66f4ed 100644 --- a/src/entities/account.rs +++ b/src/entities/account.rs @@ -56,7 +56,7 @@ pub struct Account { } /// A single name: value pair from a user's profile -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct MetadataField { /// name part of metadata pub name: String, @@ -74,7 +74,7 @@ impl MetadataField { } /// An extra object given from `verify_credentials` giving defaults about a user -#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)] +#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] pub struct Source { privacy: Option, #[serde(deserialize_with = "string_or_bool")] @@ -84,7 +84,7 @@ pub struct Source { } fn string_or_bool<'de, D: Deserializer<'de>>(val: D) -> ::std::result::Result { - #[derive(Clone, Debug, Deserialize, PartialEq)] + #[derive(Clone, Debug, Deserialize, PartialEq, Eq)] #[serde(untagged)] pub enum BoolOrString { Bool(bool), @@ -108,7 +108,7 @@ fn string_or_bool<'de, D: Deserializer<'de>>(val: D) -> ::std::result::Result, @@ -116,7 +116,7 @@ pub(crate) struct UpdateSource { pub(crate) sensitive: Option, } -#[derive(Debug, Default, Serialize, PartialEq)] +#[derive(Debug, Default, Serialize, PartialEq, Eq)] pub(crate) struct Credentials { #[serde(skip_serializing_if = "Option::is_none")] pub(crate) display_name: Option, diff --git a/src/entities/attachment.rs b/src/entities/attachment.rs index 2115b9f..1ad9c3a 100644 --- a/src/entities/attachment.rs +++ b/src/entities/attachment.rs @@ -48,7 +48,7 @@ pub struct ImageDetails { } /// The type of media attachment. -#[derive(Debug, Deserialize, Serialize, Clone, Copy, PartialEq)] +#[derive(Debug, Deserialize, Serialize, Clone, Copy, PartialEq, Eq)] pub enum MediaType { /// An image. #[serde(rename = "image")] diff --git a/src/entities/card.rs b/src/entities/card.rs index 8e95ced..3cd045c 100644 --- a/src/entities/card.rs +++ b/src/entities/card.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; /// A card of a status. -#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)] +#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] pub struct Card { /// The url associated with the card. pub url: String, diff --git a/src/entities/filter.rs b/src/entities/filter.rs index 96ecbb8..30a62f2 100644 --- a/src/entities/filter.rs +++ b/src/entities/filter.rs @@ -1,7 +1,7 @@ use serde::{Deserialize, Serialize}; /// Represents a single Filter -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct Filter { id: String, phrase: String, @@ -12,7 +12,7 @@ pub struct Filter { } /// Represents the various types of Filter contexts -#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] pub enum FilterContext { /// Represents the "home" context #[serde(rename = "home")] diff --git a/src/entities/instance.rs b/src/entities/instance.rs index 755afd5..ae725ee 100644 --- a/src/entities/instance.rs +++ b/src/entities/instance.rs @@ -32,14 +32,14 @@ pub struct Instance { } /// Object containing url for streaming api. -#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)] +#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] pub struct StreamingApi { /// Url for streaming API, typically a `wss://` url. pub streaming_api: String, } /// Statistics about the Mastodon instance. -#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq)] +#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq)] pub struct Stats { user_count: u64, status_count: u64, diff --git a/src/entities/itemsiter.rs b/src/entities/itemsiter.rs index d8df189..9769762 100644 --- a/src/entities/itemsiter.rs +++ b/src/entities/itemsiter.rs @@ -90,9 +90,7 @@ impl<'a, T: Clone + for<'de> Deserialize<'de> + Serialize> ItemsIter { Some((item, this)) } else { if this.need_next_page() { - if this.fill_next_page().await.is_none() { - return None; - } + this.fill_next_page().await?; } let idx = this.cur_idx; this.cur_idx += 1; diff --git a/src/entities/list.rs b/src/entities/list.rs index f87f058..825db14 100644 --- a/src/entities/list.rs +++ b/src/entities/list.rs @@ -1,7 +1,7 @@ use serde::{Deserialize, Serialize}; /// Used for ser/de of list resources -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)] +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub struct List { id: String, title: String, diff --git a/src/entities/mention.rs b/src/entities/mention.rs index 442ed25..88b109a 100644 --- a/src/entities/mention.rs +++ b/src/entities/mention.rs @@ -1,7 +1,7 @@ use serde::{Deserialize, Serialize}; /// Represents a `mention` used in a status -#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] +#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)] 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 f726abc..37ff8b3 100644 --- a/src/entities/mod.rs +++ b/src/entities/mod.rs @@ -33,7 +33,7 @@ pub mod search_result; pub mod status; /// An empty JSON object. -#[derive(Deserialize, Serialize, Debug, Copy, Clone, PartialEq)] +#[derive(Deserialize, Serialize, Debug, Copy, Clone, PartialEq, Eq)] pub struct Empty {} /// The purpose of this module is to alleviate imports of many common diff --git a/src/entities/notification.rs b/src/entities/notification.rs index a9ad95a..e3ede9f 100644 --- a/src/entities/notification.rs +++ b/src/entities/notification.rs @@ -5,6 +5,7 @@ use chrono::prelude::*; use serde::{Deserialize, Serialize}; /// A struct containing info about a notification. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Debug, Clone, Deserialize, Serialize, PartialEq)] pub struct Notification { /// The notification ID. @@ -21,7 +22,7 @@ pub struct Notification { } /// The type of notification. -#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq)] +#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq)] #[serde(rename_all = "lowercase")] pub enum NotificationType { /// Someone mentioned the application client in another status. diff --git a/src/entities/push.rs b/src/entities/push.rs index 5576b7d..09d392c 100644 --- a/src/entities/push.rs +++ b/src/entities/push.rs @@ -1,7 +1,7 @@ use serde::{Deserialize, Serialize}; /// Represents the `alerts` key of the `Subscription` object -#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Default)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)] pub struct Alerts { /// flag for follow alerts pub follow: Option, @@ -14,7 +14,7 @@ pub struct Alerts { } /// Represents a new Push subscription -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct Subscription { /// The `id` of the subscription pub id: String, @@ -37,19 +37,19 @@ pub(crate) mod add_subscription { pub(crate) data: Option, } - #[derive(Debug, Clone, PartialEq, Serialize, Default)] + #[derive(Debug, Clone, PartialEq, Eq, Serialize, Default)] pub(crate) struct Subscription { pub(crate) endpoint: String, pub(crate) keys: Keys, } - #[derive(Debug, Clone, PartialEq, Serialize, Default)] + #[derive(Debug, Clone, PartialEq, Eq, Serialize, Default)] pub(crate) struct Keys { pub(crate) p256dh: String, pub(crate) auth: String, } - #[derive(Debug, Clone, PartialEq, Serialize, Default)] + #[derive(Debug, Clone, PartialEq, Eq, Serialize, Default)] pub(crate) struct Data { pub(crate) alerts: Option, } @@ -60,12 +60,12 @@ pub(crate) mod update_data { use super::Alerts; - #[derive(Debug, Clone, PartialEq, Serialize, Default)] + #[derive(Debug, Clone, PartialEq, Eq, Serialize, Default)] pub(crate) struct Data { pub(crate) alerts: Option, } - #[derive(Debug, Clone, PartialEq, Serialize, Default)] + #[derive(Debug, Clone, PartialEq, Eq, Serialize, Default)] pub(crate) struct Form { pub(crate) id: String, pub(crate) data: Data, diff --git a/src/entities/relationship.rs b/src/entities/relationship.rs index e871bfe..44f89b3 100644 --- a/src/entities/relationship.rs +++ b/src/entities/relationship.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; /// A struct containing information about a relationship with another account. -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct Relationship { /// Target account id pub id: String, diff --git a/src/entities/report.rs b/src/entities/report.rs index 6d3d846..bc4c7ea 100644 --- a/src/entities/report.rs +++ b/src/entities/report.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; /// A struct containing info about a report. -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct Report { /// The ID of the report. pub id: String, diff --git a/src/entities/status.rs b/src/entities/status.rs index 44c9bd3..0a7c94c 100644 --- a/src/entities/status.rs +++ b/src/entities/status.rs @@ -65,7 +65,7 @@ pub struct Status { } /// A mention of another user. -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct Mention { /// URL of user's profile (can be remote). pub url: String, @@ -78,7 +78,7 @@ pub struct Mention { } /// Struct representing an emoji within text. -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] pub struct Emoji { /// The shortcode of the emoji pub shortcode: String, @@ -93,6 +93,7 @@ pub struct Emoji { /// as a [`Tag`](https://docs.joinmastodon.org/entities/Tag/). In the case of /// the former, at the time of writing, the history field is always empty and /// the following field is always none. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct Tag { /// The hashtag, not including the preceding `#`. @@ -107,7 +108,7 @@ pub struct Tag { } /// Application details. -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct Application { /// Name of the application. pub name: String, @@ -116,7 +117,7 @@ pub struct Application { } /// Usage statistics for given days (typically the past week). -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct TagHistory { /// UNIX timestamp on midnight of the given day. pub day: String, diff --git a/src/errors.rs b/src/errors.rs index eb547ba..9b7e7e5 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -173,7 +173,7 @@ from! { macro_rules! format_err { ( $( $arg:tt )* ) => { { - crate::Error::Other(format!($($arg)*)) + $crate::Error::Other(format!($($arg)*)) } } } diff --git a/src/event_stream.rs b/src/event_stream.rs index 9f5c11d..3295d0e 100644 --- a/src/event_stream.rs +++ b/src/event_stream.rs @@ -30,7 +30,7 @@ pub fn event_stream( while let Some(line) = lines_iter.next_line().await? { debug!(message = line, location = &location; "received message"); let line = line.trim().to_string(); - if line.starts_with(":") || line.is_empty() { + if line.starts_with(':') || line.is_empty() { continue; } lines.push(line); diff --git a/src/macros.rs b/src/macros.rs index 4b8eee3..2c7dad4 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -86,6 +86,7 @@ macro_rules! paged_routes { _marker: ::std::marker::PhantomData<&'a ()>, } + #[allow(clippy::redundant_field_names)] let qs_data = Data { $( $param: $param, @@ -135,6 +136,7 @@ macro_rules! route_v2 { _marker: ::std::marker::PhantomData<&'a ()>, } + #[allow(clippy::redundant_field_names)] let qs_data = Data { $( $param: $param, @@ -349,6 +351,7 @@ macro_rules! route { _marker: ::std::marker::PhantomData<&'a ()>, } + #[allow(clippy::redundant_field_names)] let qs_data = Data { $( $param: $param, diff --git a/src/mastodon.rs b/src/mastodon.rs index 9f58ab3..0cb0b6b 100644 --- a/src/mastodon.rs +++ b/src/mastodon.rs @@ -326,11 +326,11 @@ impl Mastodon { if ids.len() == 1 { url += "id="; - url += &ids[0]; + url += ids[0]; } else { for id in ids { url += "id[]="; - url += &id; + url += id; url += "&"; } url.pop(); @@ -427,7 +427,7 @@ impl Mastodon { }, Err(err) => { error!(path = as_debug!(path), error = as_debug!(err); "error reading file contents for multipart form"); - return Err(err.into()); + Err(err.into()) }, } } diff --git a/src/page.rs b/src/page.rs index 5c11dab..755dfd4 100644 --- a/src/page.rs +++ b/src/page.rs @@ -179,7 +179,7 @@ fn get_links(response: &Response, call_id: Uuid) -> Result<(Option, Option< let link_header = link_header.to_str()?; trace!(link_header = link_header, call_id = as_debug!(call_id); "parsing link header"); let link_header = link_header.as_bytes(); - let link_header: Link = parsing::from_raw_str(&link_header)?; + let link_header: Link = parsing::from_raw_str(link_header)?; for value in link_header.values() { if let Some(relations) = value.rel() { if relations.contains(&RelationType::Next) { diff --git a/src/registration.rs b/src/registration.rs index 40e12a1..4f4e8af 100644 --- a/src/registration.rs +++ b/src/registration.rs @@ -16,7 +16,7 @@ use crate::{ Result, }; -const DEFAULT_REDIRECT_URI: &'static str = "urn:ietf:wg:oauth:2.0:oob"; +const DEFAULT_REDIRECT_URI: &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. diff --git a/src/requests/filter.rs b/src/requests/filter.rs index a0c8b86..d3dc31b 100644 --- a/src/requests/filter.rs +++ b/src/requests/filter.rs @@ -9,7 +9,7 @@ use std::time::Duration; /// use mastodon_async::{entities::filter::FilterContext, requests::AddFilterRequest}; /// let request = AddFilterRequest::new("foo", FilterContext::Home); /// ``` -#[derive(Debug, Clone, PartialEq, Serialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] pub struct AddFilterRequest { phrase: String, context: FilterContext, diff --git a/src/requests/push.rs b/src/requests/push.rs index ab9e60e..d0a4f5b 100644 --- a/src/requests/push.rs +++ b/src/requests/push.rs @@ -12,7 +12,7 @@ use crate::{ /// /// let keys = Keys::new("anetohias===", "oeatssah="); /// ``` -#[derive(Debug, Default, Clone, PartialEq)] +#[derive(Debug, Default, Clone, PartialEq, Eq)] pub struct Keys { pub(crate) p256dh: String, pub(crate) auth: String, @@ -55,7 +55,7 @@ impl Keys { /// client.add_push_subscription(&request).await.unwrap(); /// }); /// ``` -#[derive(Debug, Default, Clone, PartialEq)] +#[derive(Debug, Default, Clone, PartialEq, Eq)] pub struct AddPushRequest { endpoint: String, @@ -215,7 +215,7 @@ impl AddPushRequest { /// client.update_push_data(&request).await.unwrap(); /// }); /// ``` -#[derive(Debug, Default, Clone, PartialEq, Serialize)] +#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize)] pub struct UpdatePushRequest { id: String, follow: Option, diff --git a/src/requests/statuses.rs b/src/requests/statuses.rs index 29177aa..61d6a8b 100644 --- a/src/requests/statuses.rs +++ b/src/requests/statuses.rs @@ -29,7 +29,7 @@ mod bool_qs_serialize { /// request.only_media().pinned().since_id("foo"); /// assert_eq!(&request.to_querystring().expect("Couldn't serialize qs")[..], "?only_media=1&pinned=1&since_id=foo"); /// ``` -#[derive(Clone, Debug, Default, PartialEq, Serialize)] +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize)] pub struct StatusesRequest<'a> { #[serde(skip_serializing_if = "bool_qs_serialize::is_false")] #[serde(serialize_with = "bool_qs_serialize::serialize")] @@ -50,16 +50,16 @@ pub struct StatusesRequest<'a> { min_id: Option>, } -impl<'a> Into>> for &'a mut StatusesRequest<'a> { - fn into(self) -> Option> { +impl<'a> From<&'a mut StatusesRequest<'a>> for Option> { + fn from(sr: &'a mut StatusesRequest<'a>) -> Self { Some(StatusesRequest { - only_media: self.only_media, - exclude_replies: self.exclude_replies, - pinned: self.pinned, - max_id: self.max_id.clone(), - since_id: self.since_id.clone(), - limit: self.limit.clone(), - min_id: self.min_id.clone(), + only_media: sr.only_media, + exclude_replies: sr.exclude_replies, + pinned: sr.pinned, + max_id: sr.max_id.clone(), + since_id: sr.since_id.clone(), + limit: sr.limit, + min_id: sr.min_id.clone(), }) } } diff --git a/src/requests/update_credentials.rs b/src/requests/update_credentials.rs index b4e0d89..c185a26 100644 --- a/src/requests/update_credentials.rs +++ b/src/requests/update_credentials.rs @@ -26,7 +26,7 @@ use crate::{ /// let result = client.update_credentials(&mut builder).await.unwrap(); /// }); /// ``` -#[derive(Debug, Default, Clone, PartialEq)] +#[derive(Debug, Default, Clone, PartialEq, Eq)] pub struct UpdateCredsRequest { display_name: Option, note: Option, @@ -176,8 +176,8 @@ impl UpdateCredsRequest { avatar: self.avatar.clone(), header: self.avatar.clone(), source: Some(UpdateSource { - privacy: self.privacy.clone(), - sensitive: self.sensitive.clone(), + privacy: self.privacy, + sensitive: self.sensitive, }), fields_attributes: self.field_attributes.clone(), }) diff --git a/src/scopes.rs b/src/scopes.rs index e7ff960..35c9a80 100644 --- a/src/scopes.rs +++ b/src/scopes.rs @@ -38,7 +38,7 @@ impl FromStr for Scopes { fn from_str(s: &str) -> Result { let mut set = HashSet::new(); for scope in s.split_whitespace() { - let scope = Scope::from_str(&scope)?; + let scope = Scope::from_str(scope)?; set.insert(scope); } Ok(Scopes { @@ -184,7 +184,7 @@ impl Scopes { .scopes .union(&other.scopes) .into_iter() - .map(|s| *s) + .copied() .collect(); Scopes { scopes: newset, @@ -264,7 +264,7 @@ impl fmt::Display for Scopes { /// Permission scope of the application. /// [Details on what each permission provides][1] /// [1]: https://github.com/tootsuite/documentation/blob/master/Using-the-API/OAuth-details.md) -#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Eq, Hash, Serialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize)] enum Scope { /// Read only permissions. #[serde(rename = "read")] @@ -302,6 +302,12 @@ impl FromStr for Scope { } } +impl PartialOrd for Scope { + fn partial_cmp(&self, other: &Scope) -> Option { + Some(self.cmp(other)) + } +} + impl Ord for Scope { fn cmp(&self, other: &Scope) -> Ordering { match (*self, *other) { diff --git a/src/status_builder.rs b/src/status_builder.rs index c99922e..5ae06a0 100644 --- a/src/status_builder.rs +++ b/src/status_builder.rs @@ -17,7 +17,7 @@ use serde::{Deserialize, Serialize}; /// .language(Language::Eng) /// .build().unwrap(); /// ``` -#[derive(Debug, Default, Clone, PartialEq)] +#[derive(Debug, Default, Clone, PartialEq, Eq)] pub struct StatusBuilder { status: Option, in_reply_to_id: Option, @@ -210,17 +210,17 @@ impl StatusBuilder { status: self.status.clone(), in_reply_to_id: self.in_reply_to_id.clone(), media_ids: self.media_ids.clone(), - sensitive: self.sensitive.clone(), + sensitive: self.sensitive, spoiler_text: self.spoiler_text.clone(), - visibility: self.visibility.clone(), - language: self.language.clone(), + visibility: self.visibility, + language: self.language, content_type: self.content_type.clone(), }) } } /// Represents a post that can be sent to the POST /api/v1/status endpoint -#[derive(Debug, Default, Clone, Serialize, PartialEq)] +#[derive(Debug, Default, Clone, Serialize, PartialEq, Eq)] pub struct NewStatus { #[serde(skip_serializing_if = "Option::is_none")] status: Option, @@ -241,7 +241,7 @@ pub struct NewStatus { } /// The visibility of a status. -#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq)] +#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq, Eq)] #[serde(rename_all = "lowercase")] pub enum Visibility { /// A Direct message to a user