From 6bdc0fea5a2fb4f6b88eb96a245e959f8140ab2d Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:43:08 +0100 Subject: [PATCH 01/58] Fix clippy: Remove unneeded return statement Signed-off-by: Matthias Beyer --- src/mastodon.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mastodon.rs b/src/mastodon.rs index 9f58ab3..4223a21 100644 --- a/src/mastodon.rs +++ b/src/mastodon.rs @@ -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()) }, } } From d7453454b33840127f794505f32100d0ea316458 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:43:37 +0100 Subject: [PATCH 02/58] Fix clippy: Remove unneeded reference Signed-off-by: Matthias Beyer --- src/mastodon.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mastodon.rs b/src/mastodon.rs index 4223a21..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(); From e19070f935e81f7f1fb7c577bed0cce269b3c7cd Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:44:07 +0100 Subject: [PATCH 03/58] Fix clippy: Remove unneeded clone() call Signed-off-by: Matthias Beyer --- src/status_builder.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/status_builder.rs b/src/status_builder.rs index c99922e..645d7e9 100644 --- a/src/status_builder.rs +++ b/src/status_builder.rs @@ -210,10 +210,10 @@ 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(), }) } From e933f1efec4835b28d0bec0939e1fadf20c0604c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:45:44 +0100 Subject: [PATCH 04/58] Fix clippy: Explicitely implement PartialOrd This patch fixes `clippy::derive_ord_xor_partial_ord` by implementing PartialOrd manually instead of deriving it. Signed-off-by: Matthias Beyer --- src/scopes.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/scopes.rs b/src/scopes.rs index e7ff960..8af8865 100644 --- a/src/scopes.rs +++ b/src/scopes.rs @@ -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) { From edad6082a1a5803c2b3aa0eca708be4d1a23b560 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:46:40 +0100 Subject: [PATCH 05/58] Fix clippy: Remove manual copying in iterator Signed-off-by: Matthias Beyer --- src/scopes.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scopes.rs b/src/scopes.rs index 8af8865..1f18664 100644 --- a/src/scopes.rs +++ b/src/scopes.rs @@ -184,7 +184,7 @@ impl Scopes { .scopes .union(&other.scopes) .into_iter() - .map(|s| *s) + .copied() .collect(); Scopes { scopes: newset, From 524c246972a8829486652bc53e7bedcb4bbc2529 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:46:58 +0100 Subject: [PATCH 06/58] Fix clippy: Remove unnecessary reference Signed-off-by: Matthias Beyer --- src/scopes.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scopes.rs b/src/scopes.rs index 1f18664..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 { From 607d86219c855f4cba1f80d77443a63dd6118194 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:47:42 +0100 Subject: [PATCH 07/58] Fix clippy: Remove unneeded clone() calls Signed-off-by: Matthias Beyer --- src/requests/statuses.rs | 2 +- src/requests/update_credentials.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/requests/statuses.rs b/src/requests/statuses.rs index 29177aa..4d260dc 100644 --- a/src/requests/statuses.rs +++ b/src/requests/statuses.rs @@ -58,7 +58,7 @@ impl<'a> Into>> for &'a mut StatusesRequest<'a> { pinned: self.pinned, max_id: self.max_id.clone(), since_id: self.since_id.clone(), - limit: self.limit.clone(), + limit: self.limit, min_id: self.min_id.clone(), }) } diff --git a/src/requests/update_credentials.rs b/src/requests/update_credentials.rs index b4e0d89..44ae566 100644 --- a/src/requests/update_credentials.rs +++ b/src/requests/update_credentials.rs @@ -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(), }) From 34932cb2959baa96a229b1e9f5cc3b1d0271ca67 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:49:55 +0100 Subject: [PATCH 08/58] Fix clippy: Implement From instead of Into Signed-off-by: Matthias Beyer --- src/requests/statuses.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/requests/statuses.rs b/src/requests/statuses.rs index 4d260dc..0e5d81f 100644 --- a/src/requests/statuses.rs +++ b/src/requests/statuses.rs @@ -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, - 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(), }) } } From af63e75e5d0b9acf48f4e29c4ddc7adf6c959e3c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:50:28 +0100 Subject: [PATCH 09/58] Fix clippy: Remove unneeded reference Signed-off-by: Matthias Beyer --- src/page.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { From e76fff06d92280b846b58e860a566c765897472f Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:50:49 +0100 Subject: [PATCH 10/58] Fix clippy: Replace str with char as pattern Signed-off-by: Matthias Beyer --- src/event_stream.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 19e4878460155a110d874a1cfa3e2e61cf998eb6 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:51:30 +0100 Subject: [PATCH 11/58] Fix clippy: Replace manual return with ? operator Signed-off-by: Matthias Beyer --- src/entities/itemsiter.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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; From b46ec54cc444180887bf567d2687ce10c1924f3d Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:52:06 +0100 Subject: [PATCH 12/58] Fix clippy: Remove unecessary ? and Ok() wrapping Signed-off-by: Matthias Beyer --- src/apps.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps.rs b/src/apps.rs index b85321a..e2da750 100644 --- a/src/apps.rs +++ b/src/apps.rs @@ -126,7 +126,7 @@ impl<'a> TryInto for AppBuilder<'a> { type Error = Error; fn try_into(self) -> Result { - Ok(self.build()?) + self.build() } } From 691117e1cb49dcf13ea370d741300efd43827924 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:52:27 +0100 Subject: [PATCH 13/58] Fix clippy: Remove uneccessary closure Signed-off-by: Matthias Beyer --- src/apps.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps.rs b/src/apps.rs index e2da750..6130758 100644 --- a/src/apps.rs +++ b/src/apps.rs @@ -116,7 +116,7 @@ impl<'a> AppBuilder<'a> { .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()), }) } From 1d86f122d3d151fef0160d8ddca8cfb356d11445 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:55:36 +0100 Subject: [PATCH 14/58] Allow redundant field names in macros Signed-off-by: Matthias Beyer --- src/macros.rs | 3 +++ 1 file changed, 3 insertions(+) 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, From f280c4b8fa05a69024f03f7732f61ba7a2f11779 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:55:59 +0100 Subject: [PATCH 15/58] Fix clippy: Remove unnecessary lifetime specifier Signed-off-by: Matthias Beyer --- src/registration.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. From 6389141015dcee12b26b49ab0f4f4e97ca6acd15 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:56:19 +0100 Subject: [PATCH 16/58] Fix: Use $crate instead of crate in macro Signed-off-by: Matthias Beyer --- src/errors.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)*)) } } } From b8a98da9581ed33b4bd528a71218928eb81e9264 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 15:58:02 +0100 Subject: [PATCH 17/58] Add workflow job for running clippy on codebase Signed-off-by: Matthias Beyer --- .github/workflows/rust.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 + From fa72eb1bd46714861444c2e4d606eb6c769a2bc1 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 17:23:22 +0100 Subject: [PATCH 18/58] Fix clippy: Remove unnecessary closure Signed-off-by: Matthias Beyer --- src/apps.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps.rs b/src/apps.rs index 6130758..5b05cae 100644 --- a/src/apps.rs +++ b/src/apps.rs @@ -110,7 +110,7 @@ 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 From 781b8a0b2ec2e3b09e9043637fa565d6ff34424b Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:48:14 +0100 Subject: [PATCH 19/58] Fix clippy: Derive Eq for Visibility Signed-off-by: Matthias Beyer --- src/status_builder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/status_builder.rs b/src/status_builder.rs index 645d7e9..f63d44c 100644 --- a/src/status_builder.rs +++ b/src/status_builder.rs @@ -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 From 1a8524f4fed81585662adb9ce663c1d9fdcc2fc2 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:48:14 +0100 Subject: [PATCH 20/58] Fix clippy: Derive Eq for StatusBuilder Signed-off-by: Matthias Beyer --- src/status_builder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/status_builder.rs b/src/status_builder.rs index f63d44c..19d72fe 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, From 2ac63466d1b74aa9d9766bade2c9746a5f723059 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:50:12 +0100 Subject: [PATCH 21/58] Fix clippy: Derive Eq for NewStatus Signed-off-by: Matthias Beyer --- src/status_builder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/status_builder.rs b/src/status_builder.rs index 19d72fe..5ae06a0 100644 --- a/src/status_builder.rs +++ b/src/status_builder.rs @@ -220,7 +220,7 @@ impl StatusBuilder { } /// 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, From cb4c0c24a99e560525cdd9859ebc8c6456fe3130 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:50:58 +0100 Subject: [PATCH 22/58] Fix clippy: Derive Eq for StatusesRequest Signed-off-by: Matthias Beyer --- src/requests/statuses.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/requests/statuses.rs b/src/requests/statuses.rs index 0e5d81f..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")] From e0b686fb2729a720d17293e4012faf6fd92c6f13 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:51:45 +0100 Subject: [PATCH 23/58] Fix clippy: Derive Eq for Keys Signed-off-by: Matthias Beyer --- src/requests/push.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/requests/push.rs b/src/requests/push.rs index ab9e60e..086e54b 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, From 3e7bd2605f27414b62c5be6bbce682b6054315d7 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:51:56 +0100 Subject: [PATCH 24/58] Fix clippy: Derive Eq for AddPushRequest Signed-off-by: Matthias Beyer --- src/requests/push.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/requests/push.rs b/src/requests/push.rs index 086e54b..00ac350 100644 --- a/src/requests/push.rs +++ b/src/requests/push.rs @@ -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, From 3757ab90b88d818f7998d29e6f40b74fa08ade28 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:52:16 +0100 Subject: [PATCH 25/58] Fix clippy: Derive Eq for UpdatePushRequest Signed-off-by: Matthias Beyer --- src/requests/push.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/requests/push.rs b/src/requests/push.rs index 00ac350..d0a4f5b 100644 --- a/src/requests/push.rs +++ b/src/requests/push.rs @@ -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, From e53ef65d6dacb08bb976928b2b66adcb215497d6 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:52:43 +0100 Subject: [PATCH 26/58] Fix clippy: Derive Eq for Empty Signed-off-by: Matthias Beyer --- src/entities/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 8572585774fc35afce94896ced0c8e466613dd18 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:53:09 +0100 Subject: [PATCH 27/58] Fix clippy: Derive Eq for MetadataField Signed-off-by: Matthias Beyer --- src/entities/account.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/account.rs b/src/entities/account.rs index 002eb40..e56b3b0 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, From bc144c5a65164acae3b7c2a6c0d425bfd2d5146f Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:56:18 +0100 Subject: [PATCH 28/58] Fix clippy: Derive Eq for Source Signed-off-by: Matthias Beyer --- src/entities/account.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/account.rs b/src/entities/account.rs index e56b3b0..770d339 100644 --- a/src/entities/account.rs +++ b/src/entities/account.rs @@ -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")] From f79c0980c78234348c1b9f7acb4012292801797c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:56:26 +0100 Subject: [PATCH 29/58] Fix clippy: Derive Eq for BoolOrString Signed-off-by: Matthias Beyer --- src/entities/account.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/account.rs b/src/entities/account.rs index 770d339..e0073be 100644 --- a/src/entities/account.rs +++ b/src/entities/account.rs @@ -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), From fea0a25b9a01d12c34de19127e6f9b4456938b89 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:56:34 +0100 Subject: [PATCH 30/58] Fix clippy: Derive Eq for UpdateSource Signed-off-by: Matthias Beyer --- src/entities/account.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/account.rs b/src/entities/account.rs index e0073be..e0404f7 100644 --- a/src/entities/account.rs +++ b/src/entities/account.rs @@ -108,7 +108,7 @@ fn string_or_bool<'de, D: Deserializer<'de>>(val: D) -> ::std::result::Result, From a383625210be707b9295456296109716bf938f53 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:56:42 +0100 Subject: [PATCH 31/58] Fix clippy: Derive Eq for Credentials Signed-off-by: Matthias Beyer --- src/entities/account.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/account.rs b/src/entities/account.rs index e0404f7..d66f4ed 100644 --- a/src/entities/account.rs +++ b/src/entities/account.rs @@ -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, From 3f70aba8bd8a2d188522e49bf0de24d89f8715dd Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:58:29 +0100 Subject: [PATCH 32/58] Fix clippy: Derive Eq for UpdateCredsRequest Signed-off-by: Matthias Beyer --- src/requests/update_credentials.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/requests/update_credentials.rs b/src/requests/update_credentials.rs index 44ae566..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, From 28ae4425650568232fa5fa65018e67d13f7e09da Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:59:01 +0100 Subject: [PATCH 33/58] Fix clippy: Derive Eq for Mention Signed-off-by: Matthias Beyer --- src/entities/status.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/status.rs b/src/entities/status.rs index 44c9bd3..11f519f 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, From a7165cd6958edb9d2090b795ad1c4fe5437f6823 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:59:08 +0100 Subject: [PATCH 34/58] Fix clippy: Derive Eq for Emoji Signed-off-by: Matthias Beyer --- src/entities/status.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/status.rs b/src/entities/status.rs index 11f519f..b829e47 100644 --- a/src/entities/status.rs +++ b/src/entities/status.rs @@ -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, From 759f651c4fa968622b804c17b43571f95f4b88c6 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:59:13 +0100 Subject: [PATCH 35/58] Fix clippy: Derive Eq for Application Signed-off-by: Matthias Beyer --- src/entities/status.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/status.rs b/src/entities/status.rs index b829e47..a793b76 100644 --- a/src/entities/status.rs +++ b/src/entities/status.rs @@ -107,7 +107,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, From afe132ae5b258222658d5160a5ca60f5cf5f39f6 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 18:59:18 +0100 Subject: [PATCH 36/58] Fix clippy: Derive Eq for TagHistory Signed-off-by: Matthias Beyer --- src/entities/status.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/status.rs b/src/entities/status.rs index a793b76..ce2b4bc 100644 --- a/src/entities/status.rs +++ b/src/entities/status.rs @@ -116,7 +116,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, From 6c65b022ffa133e40f6f7eac318f1d976ded5b85 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:00:10 +0100 Subject: [PATCH 37/58] Fix clippy: Derive Eq for Report Signed-off-by: Matthias Beyer --- src/entities/report.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From 0ba5ca3599f3a58891fe8b45068acc18fba14a71 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:00:32 +0100 Subject: [PATCH 38/58] Fix clippy: Derive Eq for Relationship Signed-off-by: Matthias Beyer --- src/entities/relationship.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From 998c477818a46b98b851ae74d97dd39b2081fd24 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:01:06 +0100 Subject: [PATCH 39/58] Fix clippy: Derive Eq for NotificationType Signed-off-by: Matthias Beyer --- src/entities/notification.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/notification.rs b/src/entities/notification.rs index a9ad95a..3af9f50 100644 --- a/src/entities/notification.rs +++ b/src/entities/notification.rs @@ -21,7 +21,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. From adac2874502bb9abfcbfa2f4f7529f7b4399c03b Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:01:42 +0100 Subject: [PATCH 40/58] Fix: Notification type is not able to derive Eq Signed-off-by: Matthias Beyer --- src/entities/notification.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/entities/notification.rs b/src/entities/notification.rs index 3af9f50..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. From b97dc8ca3e9c1664b647a7c4b31ddbefa9acb440 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:01:54 +0100 Subject: [PATCH 41/58] Fix: Tag type is not able to derive Eq Signed-off-by: Matthias Beyer --- src/entities/status.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/entities/status.rs b/src/entities/status.rs index ce2b4bc..0a7c94c 100644 --- a/src/entities/status.rs +++ b/src/entities/status.rs @@ -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 `#`. From 8ee0de9a6f4964458a21234b91dde163d679e867 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:03:11 +0100 Subject: [PATCH 42/58] Fix clippy: Derive Eq for Alerts Signed-off-by: Matthias Beyer --- src/entities/push.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/push.rs b/src/entities/push.rs index 5576b7d..0a63f77 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, From bb31b91933f566b48092363c4fd60248eddf8eb0 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:03:24 +0100 Subject: [PATCH 43/58] Fix clippy: Derive Eq for Subscription Signed-off-by: Matthias Beyer --- src/entities/push.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/push.rs b/src/entities/push.rs index 0a63f77..da6a0c2 100644 --- a/src/entities/push.rs +++ b/src/entities/push.rs @@ -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, From 31ad0beec105b9394d2a777990c9d1f0d1890ac9 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:03:43 +0100 Subject: [PATCH 44/58] Fix clippy: Derive Eq for Subscription Signed-off-by: Matthias Beyer --- src/entities/push.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/push.rs b/src/entities/push.rs index da6a0c2..fea5f12 100644 --- a/src/entities/push.rs +++ b/src/entities/push.rs @@ -37,7 +37,7 @@ 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, From fcb8dc9e07a8f424f2a745450d056f7a00f345f7 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:03:55 +0100 Subject: [PATCH 45/58] Fix clippy: Derive Eq for Keys Signed-off-by: Matthias Beyer --- src/entities/push.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/push.rs b/src/entities/push.rs index fea5f12..cec6186 100644 --- a/src/entities/push.rs +++ b/src/entities/push.rs @@ -43,7 +43,7 @@ pub(crate) mod add_subscription { 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, From 9cec1a73844abeb9231a38361663c0c6e47b5f47 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:04:05 +0100 Subject: [PATCH 46/58] Fix clippy: Derive Eq for Data Signed-off-by: Matthias Beyer --- src/entities/push.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/push.rs b/src/entities/push.rs index cec6186..d6cd218 100644 --- a/src/entities/push.rs +++ b/src/entities/push.rs @@ -49,7 +49,7 @@ pub(crate) mod add_subscription { 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, } From 4cadd9b937819ab7d7942fdf72cbaf83c342c594 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:04:11 +0100 Subject: [PATCH 47/58] Fix clippy: Derive Eq for Data Signed-off-by: Matthias Beyer --- src/entities/push.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/push.rs b/src/entities/push.rs index d6cd218..227ba2e 100644 --- a/src/entities/push.rs +++ b/src/entities/push.rs @@ -60,7 +60,7 @@ 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, } From eaea2a50bd5c360f0be6eafc03c0e81a086b1687 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:04:15 +0100 Subject: [PATCH 48/58] Fix clippy: Derive Eq for Form Signed-off-by: Matthias Beyer --- src/entities/push.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/push.rs b/src/entities/push.rs index 227ba2e..09d392c 100644 --- a/src/entities/push.rs +++ b/src/entities/push.rs @@ -65,7 +65,7 @@ pub(crate) mod update_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, From e3539a46ba22028cffc1b09e6a5e62535a6f612f Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:04:40 +0100 Subject: [PATCH 49/58] Fix clippy: Derive Eq for Mention Signed-off-by: Matthias Beyer --- src/entities/mention.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From 0e2ee6717f577a7ee5a9359e2e534feb24f8563e Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:04:53 +0100 Subject: [PATCH 50/58] Fix clippy: Derive Eq for List Signed-off-by: Matthias Beyer --- src/entities/list.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From 738d97d65fb196653316846537c3e9e396287c5f Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:05:05 +0100 Subject: [PATCH 51/58] Fix clippy: Derive Eq for Stats Signed-off-by: Matthias Beyer --- src/entities/instance.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/instance.rs b/src/entities/instance.rs index 755afd5..d520170 100644 --- a/src/entities/instance.rs +++ b/src/entities/instance.rs @@ -39,7 +39,7 @@ pub struct StreamingApi { } /// 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, From bf9bad441fb3428de30652b95bae2506d0a549b0 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:05:31 +0100 Subject: [PATCH 52/58] Fix clippy: Derive Eq for StreamingApi Signed-off-by: Matthias Beyer --- src/entities/instance.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/instance.rs b/src/entities/instance.rs index d520170..ae725ee 100644 --- a/src/entities/instance.rs +++ b/src/entities/instance.rs @@ -32,7 +32,7 @@ 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, From 789fbd69f50e3e60ee969b280c23b21a53ad96cc Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:05:52 +0100 Subject: [PATCH 53/58] Fix clippy: Derive Eq for FilterContext Signed-off-by: Matthias Beyer --- src/entities/filter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/filter.rs b/src/entities/filter.rs index 96ecbb8..c32481e 100644 --- a/src/entities/filter.rs +++ b/src/entities/filter.rs @@ -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")] From 609ddc895b52a9834e7b1d25798a580fa6efee85 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:04:53 +0100 Subject: [PATCH 54/58] Fix clippy: Derive Eq for AddFilterRequest Signed-off-by: Matthias Beyer --- src/requests/filter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From ee4e00affdb8d3d1cc5014058839b767a975cfe4 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:07:49 +0100 Subject: [PATCH 55/58] Fix clippy: Derive Eq for Filter Signed-off-by: Matthias Beyer --- src/entities/filter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/filter.rs b/src/entities/filter.rs index c32481e..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, From 8cfe447aa11d3187dd7e772380528fd0ddbbfa80 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:08:13 +0100 Subject: [PATCH 56/58] Fix clippy: Derive Eq for Card Signed-off-by: Matthias Beyer --- src/entities/card.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From afb3f59fc7ef82b792d3c16326de467e80ff0241 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:08:24 +0100 Subject: [PATCH 57/58] Fix clippy: Derive Eq for MediaType Signed-off-by: Matthias Beyer --- src/entities/attachment.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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")] From 29463764c1a2c41968ebadd4e25a9d13f9691b02 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Dec 2022 19:08:43 +0100 Subject: [PATCH 58/58] Fix clippy: Derive Eq for Data Signed-off-by: Matthias Beyer --- src/data.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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>,