From 14ea574da7cd513beb0e0f50e0142476fe0dacf1 Mon Sep 17 00:00:00 2001 From: HTG-YT <39023054+HTG-YT@users.noreply.github.com> Date: Mon, 20 Jun 2022 15:06:54 +0800 Subject: [PATCH] fix stuff --- http/src/route.rs | 87 ++++++++++++++++++++++++++++----------- model/Cargo.toml | 2 +- model/src/user/partial.rs | 2 +- 3 files changed, 65 insertions(+), 26 deletions(-) diff --git a/http/src/route.rs b/http/src/route.rs index d2a8593..3e60bbb 100644 --- a/http/src/route.rs +++ b/http/src/route.rs @@ -245,9 +245,7 @@ impl<'a> Route<'a> { impl Display for Route<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult { match self { - Self::ChannelCreate => { - f.write_str("channels") - } + Self::ChannelCreate => f.write_str("channels"), Self::ChannelDelete { channel_id } | Self::ChannelRead { channel_id } | Self::ChannelUpdate { channel_id } => { @@ -291,12 +289,12 @@ impl Display for Route<'_> { if let Some(after) = after { f.write_str("after=")?; - Display::fmt(after, f)?; + Display::fmt(&after.display(), f)?; } if let Some(before) = before { f.write_str("&before=")?; - Display::fmt(before, f)?; + Display::fmt(&before.display(), f)?; } if let Some(include_private) = include_private { @@ -311,8 +309,16 @@ impl Display for Route<'_> { Ok(()) } - Self::ContentReactionCreate { channel_id, content_id, emote_id } - | Self::ContentReactionDelete { channel_id, content_id, emote_id} => { + Self::ContentReactionCreate { + channel_id, + content_id, + emote_id, + } + | Self::ContentReactionDelete { + channel_id, + content_id, + emote_id, + } => { f.write_str("channels/")?; Display::fmt(channel_id, f)?; f.write_str("/content/")?; @@ -320,8 +326,7 @@ impl Display for Route<'_> { f.write_str("/emotes/")?; Display::fmt(emote_id, f) } - Self::DocCreate { channel_id } - | Self::DocReadMany { channel_id } => { + Self::DocCreate { channel_id } | Self::DocReadMany { channel_id } => { f.write_str("channels/")?; Display::fmt(channel_id, f)?; f.write_str("/docs") @@ -346,23 +351,37 @@ impl Display for Route<'_> { f.write_str("/members/")?; Display::fmt(user_id, f) } - Self::ListItemCreate { channel_id } - | Self::ListItemReadMany { channel_id } => { + Self::ListItemCreate { channel_id } | Self::ListItemReadMany { channel_id } => { f.write_str("channels/")?; Display::fmt(channel_id, f)?; f.write_str("/items") } - Self::ListItemCompleteCreate { channel_id, list_item_id } - | Self::ListItemCompleteDelete { channel_id, list_item_id } => { + Self::ListItemCompleteCreate { + channel_id, + list_item_id, + } + | Self::ListItemCompleteDelete { + channel_id, + list_item_id, + } => { f.write_str("channels/")?; Display::fmt(channel_id, f)?; f.write_str("/items/")?; Display::fmt(list_item_id, f)?; f.write_str("/complete") } - Self::ListItemDelete { channel_id, list_item_id } - | Self::ListItemRead { channel_id, list_item_id } - | Self::ListItemUpdate { channel_id, list_item_id } => { + Self::ListItemDelete { + channel_id, + list_item_id, + } + | Self::ListItemRead { + channel_id, + list_item_id, + } + | Self::ListItemUpdate { + channel_id, + list_item_id, + } => { f.write_str("channels/")?; Display::fmt(channel_id, f)?; f.write_str("/items/")?; @@ -376,7 +395,11 @@ impl Display for Route<'_> { Display::fmt(user_id, f)?; f.write_str("/nickname") } - Self::MemberSocialLinkRead { server_id, user_id, r#type } => { + Self::MemberSocialLinkRead { + server_id, + user_id, + r#type, + } => { f.write_str("servers/")?; Display::fmt(server_id, f)?; f.write_str("/members/")?; @@ -384,8 +407,16 @@ impl Display for Route<'_> { f.write_str("/social-links/")?; Display::fmt(r#type, f) } - Self::RoleMembershipCreate { role_id, server_id, user_id} - | Self::RoleMembershipDelete { role_id, server_id, user_id } => { + Self::RoleMembershipCreate { + role_id, + server_id, + user_id, + } + | Self::RoleMembershipDelete { + role_id, + server_id, + user_id, + } => { f.write_str("servers/")?; Display::fmt(server_id, f)?; f.write_str("/members/")?; @@ -443,15 +474,23 @@ impl Display for Route<'_> { Display::fmt(user_id, f)?; f.write_str("/xp") } - Self::WebhookCreate { server_id } - | Self::WebhookReadMany { server_id } => { + Self::WebhookCreate { server_id } | Self::WebhookReadMany { server_id } => { f.write_str("servers/")?; Display::fmt(server_id, f)?; f.write_str("/webhooks") } - Self::WebhookDelete { server_id, webhook_id } - | Self::WebhookRead { server_id, webhook_id } - | Self::WebhookUpdate { server_id, webhook_id} => { + Self::WebhookDelete { + server_id, + webhook_id, + } + | Self::WebhookRead { + server_id, + webhook_id, + } + | Self::WebhookUpdate { + server_id, + webhook_id, + } => { f.write_str("servers/")?; Display::fmt(server_id, f)?; f.write_str("/webhooks/")?; diff --git a/model/Cargo.toml b/model/Cargo.toml index 57837da..ffdd2c7 100644 --- a/model/Cargo.toml +++ b/model/Cargo.toml @@ -12,5 +12,5 @@ version = "0.1.0-dev" [dependencies] serde = { default-features = false, features = [ "derive", "std" ], version = "1.0.137" } -time = { default-features = false, features = [ "parsing", "std" ], version = "0.3.5" } +time = { default-features = false, features = [ "parsing", "std" ], version = "0.3.10" } uuid = { default-features = false, features = [ "v5" ], version = "0.8.2" } diff --git a/model/src/user/partial.rs b/model/src/user/partial.rs index d791ae1..26a0fb9 100644 --- a/model/src/user/partial.rs +++ b/model/src/user/partial.rs @@ -29,6 +29,6 @@ impl PartialUser { } pub fn r#type(&self) -> UserType { - self.r#type.clone() + self.r#type } }