Remove lots of Copy implementations

so we don't have do breaking releases once they can't be Copy anymore.
This commit is contained in:
Jonas Platte 2020-12-24 02:51:08 +01:00
parent 25d283fa81
commit 19ae6ff347
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
20 changed files with 27 additions and 32 deletions

View File

@ -2,7 +2,7 @@
//! endpoint in the [Matrix](https://matrix.org/) application service API specification. These //! endpoint in the [Matrix](https://matrix.org/) application service API specification. These
//! types can be shared by application service and server code. //! types can be shared by application service and server code.
#![warn(missing_copy_implementations, missing_debug_implementations, missing_docs)] #![warn(missing_debug_implementations, missing_docs)]
pub mod event; pub mod event;
pub mod query; pub mod query;

View File

@ -2,7 +2,7 @@
//! endpoint in the [Matrix](https://matrix.org/) client API specification. These types can be //! endpoint in the [Matrix](https://matrix.org/) client API specification. These types can be
//! shared by client and server code. //! shared by client and server code.
#![warn(missing_copy_implementations, missing_debug_implementations, missing_docs)] #![warn(missing_debug_implementations, missing_docs)]
pub mod error; pub mod error;
pub mod r0; pub mod r0;

View File

@ -100,7 +100,7 @@ impl Response {
} }
/// The kind of account being registered. /// The kind of account being registered.
#[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum RegistrationKind { pub enum RegistrationKind {
/// A guest account /// A guest account

View File

@ -83,10 +83,10 @@ impl Capabilities {
} }
/// Information about the m.change_password capability /// Information about the m.change_password capability
#[derive(Clone, Copy, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct ChangePasswordCapability { pub struct ChangePasswordCapability {
/// True if the user can change their password, false otherwise. /// `true` if the user can change their password, `false` otherwise.
pub enabled: bool, pub enabled: bool,
} }

View File

@ -35,7 +35,7 @@ impl Default for EventFormat {
} }
/// Filters to be applied to room events. /// Filters to be applied to room events.
#[derive(Clone, Copy, Debug, Default, Outgoing, Serialize)] #[derive(Clone, Debug, Default, Outgoing, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[incoming_derive(Clone, Default, Serialize)] #[incoming_derive(Clone, Default, Serialize)]
pub struct RoomEventFilter<'a> { pub struct RoomEventFilter<'a> {
@ -142,7 +142,7 @@ impl IncomingRoomEventFilter {
} }
/// Filters to be applied to room data. /// Filters to be applied to room data.
#[derive(Clone, Copy, Debug, Default, Outgoing, Serialize)] #[derive(Clone, Debug, Default, Outgoing, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[incoming_derive(Clone, Default, Serialize)] #[incoming_derive(Clone, Default, Serialize)]
pub struct RoomFilter<'a> { pub struct RoomFilter<'a> {
@ -224,7 +224,7 @@ impl IncomingRoomFilter {
} }
/// Filter for non-room data. /// Filter for non-room data.
#[derive(Clone, Copy, Debug, Default, Outgoing, Serialize)] #[derive(Clone, Debug, Default, Outgoing, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[incoming_derive(Clone, Default, Serialize)] #[incoming_derive(Clone, Default, Serialize)]
pub struct Filter<'a> { pub struct Filter<'a> {

View File

@ -54,7 +54,7 @@ pub struct CrossSigningKey {
} }
/// The usage of a cross signing key. /// The usage of a cross signing key.
#[derive(Clone, Copy, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum KeyUsage { pub enum KeyUsage {
/// Master key. /// Master key.

View File

@ -120,7 +120,7 @@ fn is_default_limit(val: &UInt) -> bool {
} }
/// The direction to return events from. /// The direction to return events from.
#[derive(Clone, Copy, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub enum Direction { pub enum Direction {
/// Return events backwards in time from the requested `from` token. /// Return events backwards in time from the requested `from` token.
#[serde(rename = "b")] #[serde(rename = "b")]

View File

@ -118,7 +118,7 @@ impl<'a> Criteria<'a> {
} }
/// Configures whether any context for the events returned are included in the response. /// Configures whether any context for the events returned are included in the response.
#[derive(Clone, Copy, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct EventContext { pub struct EventContext {
/// How many events before the result are returned. /// How many events before the result are returned.
@ -250,7 +250,7 @@ pub enum GroupingKey {
} }
/// Requests that the server partitions the result set based on the provided list of keys. /// Requests that the server partitions the result set based on the provided list of keys.
#[derive(Clone, Copy, Default, Debug, Outgoing, Serialize)] #[derive(Clone, Default, Debug, Outgoing, Serialize)]
#[incoming_derive(Default)] #[incoming_derive(Default)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct Groupings<'a> { pub struct Groupings<'a> {

View File

@ -39,7 +39,7 @@ impl Response {
} }
/// An authentication mechanism. /// An authentication mechanism.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize)] #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(tag = "type")] #[serde(tag = "type")]
pub enum LoginType { pub enum LoginType {
/// A password is supplied to authenticate. /// A password is supplied to authenticate.

View File

@ -107,7 +107,7 @@ pub enum UserInfo<'a> {
} }
/// The authentication mechanism. /// The authentication mechanism.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Outgoing, Serialize)] #[derive(Clone, Debug, PartialEq, Eq, Outgoing, Serialize)]
#[serde(tag = "type")] #[serde(tag = "type")]
pub enum LoginInfo<'a> { pub enum LoginInfo<'a> {
/// A password is supplied to authenticate. /// A password is supplied to authenticate.

View File

@ -264,7 +264,7 @@ impl JoinedRoom {
} }
/// unread notifications count /// unread notifications count
#[derive(Clone, Copy, Default, Debug, Deserialize, Serialize)] #[derive(Clone, Default, Debug, Deserialize, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct UnreadNotificationsCount { pub struct UnreadNotificationsCount {
/// The number of unread notifications for this room with the highlight flag set. /// The number of unread notifications for this room with the highlight flag set.

View File

@ -98,7 +98,7 @@
//! ``` //! ```
#![warn(rust_2018_idioms)] #![warn(rust_2018_idioms)]
#![deny(missing_copy_implementations, missing_debug_implementations, missing_docs)] #![deny(missing_debug_implementations, missing_docs)]
use std::{ use std::{
convert::TryFrom, convert::TryFrom,

View File

@ -19,7 +19,7 @@ impl Display for InvalidInput {
impl Error for InvalidInput {} impl Error for InvalidInput {}
/// An error when attempting to create a value from a string via the `FromStr` trait. /// An error when attempting to create a value from a string via the `FromStr` trait.
#[derive(Clone, Copy, Eq, Debug, Hash, PartialEq)] #[derive(Clone, Eq, Debug, Hash, PartialEq)]
pub struct FromStrError; pub struct FromStrError;
impl Display for FromStrError { impl Display for FromStrError {

View File

@ -116,7 +116,7 @@ pub struct SignedContent {
} }
/// Translation of the membership change in `m.room.member` event. /// Translation of the membership change in `m.room.member` event.
#[derive(Clone, Copy, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub enum MembershipChange { pub enum MembershipChange {
/// No change. /// No change.

View File

@ -127,7 +127,7 @@ impl Default for PowerLevelsEventContent {
} }
/// The power level requirements for specific notification types. /// The power level requirements for specific notification types.
#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)] #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub struct NotificationPowerLevels { pub struct NotificationPowerLevels {
/// The level required to trigger an `@room` notification. /// The level required to trigger an `@room` notification.
#[cfg_attr( #[cfg_attr(

View File

@ -1,12 +1,7 @@
//! Crate **ruma_identifiers** contains types for [Matrix](https://matrix.org/) identifiers //! Crate **ruma_identifiers** contains types for [Matrix](https://matrix.org/) identifiers
//! for events, rooms, room aliases, room versions, and users. //! for events, rooms, room aliases, room versions, and users.
#![warn( #![warn(rust_2018_idioms, missing_debug_implementations, missing_docs)]
rust_2018_idioms,
missing_copy_implementations,
missing_debug_implementations,
missing_docs
)]
#![cfg_attr(docsrs, feature(doc_cfg))] #![cfg_attr(docsrs, feature(doc_cfg))]
// Renamed in `Cargo.toml` so we can have a serde feature. // Renamed in `Cargo.toml` so we can have a serde feature.

View File

@ -154,7 +154,7 @@ impl Default for NotificationPriority {
} }
/// Type for passing information about notification counts. /// Type for passing information about notification counts.
#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, PartialEq)] #[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct NotificationCounts { pub struct NotificationCounts {
/// The number of unread messages a user has across all of the rooms they /// The number of unread messages a user has across all of the rooms they

View File

@ -42,7 +42,7 @@
//! these respective functions for more details and full examples of use. //! these respective functions for more details and full examples of use.
#![warn(rust_2018_idioms)] #![warn(rust_2018_idioms)]
#![deny(missing_copy_implementations, missing_debug_implementations, missing_docs)] #![deny(missing_debug_implementations, missing_docs)]
use std::{ use std::{
error::Error as StdError, error::Error as StdError,
@ -117,7 +117,7 @@ impl From<ruma_serde::CanonicalJsonError> for Error {
} }
/// The algorithm used for signing data. /// The algorithm used for signing data.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, AsRefStr, DisplayAsRefStr)] #[derive(Clone, Debug, Eq, Hash, PartialEq, AsRefStr, DisplayAsRefStr)]
#[ruma_enum(rename_all = "snake_case")] #[ruma_enum(rename_all = "snake_case")]
pub enum Algorithm { pub enum Algorithm {
/// The Ed25519 digital signature algorithm. /// The Ed25519 digital signature algorithm.

View File

@ -62,8 +62,8 @@ impl Signature {
} }
/// The algorithm used to generate the signature. /// The algorithm used to generate the signature.
pub fn algorithm(&self) -> Algorithm { pub fn algorithm(&self) -> &Algorithm {
self.algorithm &self.algorithm
} }
/// The raw bytes of the signature. /// The raw bytes of the signature.

View File

@ -23,7 +23,7 @@ pub trait Verifier {
} }
/// A verifier for Ed25519 digital signatures. /// A verifier for Ed25519 digital signatures.
#[derive(Clone, Copy, Debug, Default, PartialEq)] #[derive(Debug, Default, PartialEq)]
pub struct Ed25519Verifier; pub struct Ed25519Verifier;
impl Verifier for Ed25519Verifier { impl Verifier for Ed25519Verifier {
@ -46,7 +46,7 @@ impl Verifier for Ed25519Verifier {
/// calculated during verification. This is not necessarily an error condition, as it may indicate /// calculated during verification. This is not necessarily an error condition, as it may indicate
/// that the event has been redacted. In this case, receiving homeservers should store a redacted /// that the event has been redacted. In this case, receiving homeservers should store a redacted
/// version of the event. /// version of the event.
#[derive(Debug, Clone, Copy, Hash, PartialEq)] #[derive(Clone, Debug, Hash, PartialEq)]
pub enum Verified { pub enum Verified {
/// All signatures are valid and the content hashes match. /// All signatures are valid and the content hashes match.
All, All,