From 7f18e1c32e90cde1020960f686b49d78109f49be Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Wed, 6 Feb 2019 20:12:30 +0100 Subject: [PATCH] Replace serde_derive by re-exports in serde --- Cargo.toml | 8 +++++--- src/call/answer.rs | 2 +- src/call/candidates.rs | 2 +- src/call/hangup.rs | 2 +- src/call/invite.rs | 2 +- src/call/mod.rs | 2 +- src/direct.rs | 2 +- src/lib.rs | 1 - src/presence.rs | 2 +- src/receipt.rs | 2 +- src/room/aliases.rs | 2 +- src/room/avatar.rs | 2 +- src/room/canonical_alias.rs | 2 +- src/room/create.rs | 2 +- src/room/guest_access.rs | 2 +- src/room/history_visibility.rs | 2 +- src/room/join_rules.rs | 2 +- src/room/member.rs | 2 +- src/room/message.rs | 1 - src/room/mod.rs | 2 +- src/room/name.rs | 2 +- src/room/pinned_events.rs | 2 +- src/room/power_levels.rs | 2 +- src/room/redaction.rs | 2 +- src/room/third_party_invite.rs | 2 +- src/room/topic.rs | 2 +- src/stripped.rs | 1 - src/tag.rs | 2 +- src/typing.rs | 2 +- 29 files changed, 30 insertions(+), 31 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8b14cc3e..bdc7cb3f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,8 @@ edition = "2018" [dependencies] ruma-identifiers = "0.11.0" ruma-signatures = "0.4.1" -serde = "1.0.80" -serde_derive = "1.0.80" -serde_json = "1.0.33" +serde_json = "1.0.38" + +[dependencies.serde] +version = "1.0.87" +features = ["derive"] diff --git a/src/call/answer.rs b/src/call/answer.rs index a756953d..e3193d91 100644 --- a/src/call/answer.rs +++ b/src/call/answer.rs @@ -1,6 +1,6 @@ //! Types for the *m.call.answer* event. -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; use super::SessionDescription; diff --git a/src/call/candidates.rs b/src/call/candidates.rs index ff777423..99543f05 100644 --- a/src/call/candidates.rs +++ b/src/call/candidates.rs @@ -1,6 +1,6 @@ //! Types for the *m.call.candidates* event. -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; room_event! { /// This event is sent by callers after sending an invite and by the callee after answering. diff --git a/src/call/hangup.rs b/src/call/hangup.rs index 73ab4892..6a87b875 100644 --- a/src/call/hangup.rs +++ b/src/call/hangup.rs @@ -1,6 +1,6 @@ //! Types for the *m.call.hangup* event. -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; room_event! { /// Sent by either party to signal their termination of the call. This can be sent either once diff --git a/src/call/invite.rs b/src/call/invite.rs index 05b73eb8..7962b136 100644 --- a/src/call/invite.rs +++ b/src/call/invite.rs @@ -1,6 +1,6 @@ //! Types for the *m.call.invite* event. -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; use super::SessionDescription; diff --git a/src/call/mod.rs b/src/call/mod.rs index 47ad932c..da8b0272 100644 --- a/src/call/mod.rs +++ b/src/call/mod.rs @@ -2,7 +2,7 @@ //! //! This module also contains types shared by events in its child namespaces. -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; pub mod answer; pub mod candidates; diff --git a/src/direct.rs b/src/direct.rs index 4089c1f1..bc72fe0a 100644 --- a/src/direct.rs +++ b/src/direct.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use ruma_identifiers::{RoomId, UserId}; -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; event! { /// Informs the client about the rooms that are considered direct by a user. diff --git a/src/lib.rs b/src/lib.rs index df16676c..07f832d1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -107,7 +107,6 @@ use serde::{ de::{Error as SerdeError, Visitor}, Deserialize, Deserializer, Serialize, Serializer, }; -use serde_derive::{Deserialize, Serialize}; use serde_json::Value; #[macro_use] diff --git a/src/presence.rs b/src/presence.rs index cfbef4c2..0aeca202 100644 --- a/src/presence.rs +++ b/src/presence.rs @@ -1,6 +1,6 @@ //! Types for the *m.presence* event. -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; use ruma_identifiers::UserId; diff --git a/src/receipt.rs b/src/receipt.rs index de9acae9..35a07234 100644 --- a/src/receipt.rs +++ b/src/receipt.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use ruma_identifiers::{EventId, RoomId, UserId}; -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; event! { /// Informs the client of new receipts. diff --git a/src/room/aliases.rs b/src/room/aliases.rs index 4cdee7e0..0a8edddf 100644 --- a/src/room/aliases.rs +++ b/src/room/aliases.rs @@ -1,7 +1,7 @@ //! Types for the *m.room.aliases* event. use ruma_identifiers::RoomAliasId; -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; state_event! { /// Informs the room about what room aliases it has been given. diff --git a/src/room/avatar.rs b/src/room/avatar.rs index 203269c3..bd218775 100644 --- a/src/room/avatar.rs +++ b/src/room/avatar.rs @@ -1,6 +1,6 @@ //! Types for the *m.room.avatar* event. -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; use super::ImageInfo; diff --git a/src/room/canonical_alias.rs b/src/room/canonical_alias.rs index 23010529..bbd6d689 100644 --- a/src/room/canonical_alias.rs +++ b/src/room/canonical_alias.rs @@ -1,7 +1,7 @@ //! Types for the *m.room.canonical_alias* event. use ruma_identifiers::RoomAliasId; -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; state_event! { /// Informs the room as to which alias is the canonical one. diff --git a/src/room/create.rs b/src/room/create.rs index c19a1847..9deeb956 100644 --- a/src/room/create.rs +++ b/src/room/create.rs @@ -1,7 +1,7 @@ //! Types for the *m.room.create* event. use ruma_identifiers::UserId; -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; state_event! { /// This is the first event in a room and cannot be changed. It acts as the root of all other diff --git a/src/room/guest_access.rs b/src/room/guest_access.rs index e865a684..28b26dae 100644 --- a/src/room/guest_access.rs +++ b/src/room/guest_access.rs @@ -1,6 +1,6 @@ //! Types for the *m.room.guest_access* event. -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; state_event! { /// Controls whether guest users are allowed to join rooms. diff --git a/src/room/history_visibility.rs b/src/room/history_visibility.rs index ace8661b..f33aeb09 100644 --- a/src/room/history_visibility.rs +++ b/src/room/history_visibility.rs @@ -1,6 +1,6 @@ //! Types for the *m.room.history_visibility* event. -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; state_event! { /// This event controls whether a member of a room can see the events that happened in a room diff --git a/src/room/join_rules.rs b/src/room/join_rules.rs index 6546482d..dfe1e04d 100644 --- a/src/room/join_rules.rs +++ b/src/room/join_rules.rs @@ -1,6 +1,6 @@ //! Types for the *m.room.join_rules* event. -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; state_event! { /// Describes how users are allowed to join the room. diff --git a/src/room/member.rs b/src/room/member.rs index a3258bcd..75aed7c0 100644 --- a/src/room/member.rs +++ b/src/room/member.rs @@ -2,7 +2,7 @@ use ruma_identifiers::UserId; use ruma_signatures::Signatures; -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; use crate::stripped::StrippedState; diff --git a/src/room/message.rs b/src/room/message.rs index 66c1d1ac..e4763d8a 100644 --- a/src/room/message.rs +++ b/src/room/message.rs @@ -1,7 +1,6 @@ //! Types for the *m.room.message* event. use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer}; -use serde_derive::{Deserialize, Serialize}; use serde_json::{from_value, Value}; use super::{ImageInfo, ThumbnailInfo}; diff --git a/src/room/mod.rs b/src/room/mod.rs index be511380..d05a03d6 100644 --- a/src/room/mod.rs +++ b/src/room/mod.rs @@ -2,7 +2,7 @@ //! //! This module also contains types shared by events in its child namespaces. -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; pub mod aliases; pub mod avatar; diff --git a/src/room/name.rs b/src/room/name.rs index d744a425..629a89aa 100644 --- a/src/room/name.rs +++ b/src/room/name.rs @@ -1,6 +1,6 @@ //! Types for the *m.room.name* event. -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; state_event! { /// A human-friendly room name designed to be displayed to the end-user. diff --git a/src/room/pinned_events.rs b/src/room/pinned_events.rs index 2ed59e9d..de07120d 100644 --- a/src/room/pinned_events.rs +++ b/src/room/pinned_events.rs @@ -1,7 +1,7 @@ //! Types for the *m.room.pinned_events* event. use ruma_identifiers::EventId; -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; state_event! { /// Used to "pin" particular events in a room for other participants to review later. diff --git a/src/room/power_levels.rs b/src/room/power_levels.rs index 04ba4d61..6d787278 100644 --- a/src/room/power_levels.rs +++ b/src/room/power_levels.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use ruma_identifiers::UserId; -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; use crate::EventType; diff --git a/src/room/redaction.rs b/src/room/redaction.rs index a300b2ce..cb4da09d 100644 --- a/src/room/redaction.rs +++ b/src/room/redaction.rs @@ -1,7 +1,7 @@ //! Types for the *m.room.redaction* event. use ruma_identifiers::EventId; -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; room_event! { /// A redaction of an event. diff --git a/src/room/third_party_invite.rs b/src/room/third_party_invite.rs index 865aec91..790bb141 100644 --- a/src/room/third_party_invite.rs +++ b/src/room/third_party_invite.rs @@ -1,6 +1,6 @@ //! Types for the *m.room.third_party_invite* event. -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; state_event! { /// An invitation to a room issued to a third party identifier, rather than a matrix user ID. diff --git a/src/room/topic.rs b/src/room/topic.rs index 559a84e9..45495a65 100644 --- a/src/room/topic.rs +++ b/src/room/topic.rs @@ -1,6 +1,6 @@ //! Types for the *m.room.topic* event. -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; state_event! { /// A topic is a short message detailing what is currently being discussed in the room. diff --git a/src/stripped.rs b/src/stripped.rs index 37f05b21..c8b8a1f6 100644 --- a/src/stripped.rs +++ b/src/stripped.rs @@ -7,7 +7,6 @@ use ruma_identifiers::UserId; use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer}; -use serde_derive::{Deserialize, Serialize}; use serde_json::{from_value, Value}; use crate::{ diff --git a/src/tag.rs b/src/tag.rs index d3d83bfa..7fee06e9 100644 --- a/src/tag.rs +++ b/src/tag.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; event! { /// Informs the client of tags on a room. diff --git a/src/typing.rs b/src/typing.rs index e9e3e85f..d0542be4 100644 --- a/src/typing.rs +++ b/src/typing.rs @@ -1,7 +1,7 @@ //! Types for the *m.typing* event. use ruma_identifiers::{RoomId, UserId}; -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; event! { /// Informs the client of the list of users currently typing.