Deny and address all warnings.
This commit is contained in:
parent
95c3b929a5
commit
de23971ee4
@ -1,7 +1,10 @@
|
|||||||
//! Enums for heterogeneous collections of events, inclusive for every event type that implements
|
//! Enums for heterogeneous collections of events, inclusive for every event type that implements
|
||||||
//! the trait of the same name.
|
//! the trait of the same name.
|
||||||
|
|
||||||
use std::{convert::TryFrom, str::FromStr};
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use serde::{Serialize, Serializer};
|
||||||
|
use serde_json::{from_value, Value};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
call::{
|
call::{
|
||||||
@ -48,9 +51,6 @@ use crate::{
|
|||||||
CustomEvent, CustomRoomEvent, CustomStateEvent, EventType, InnerInvalidEvent, InvalidEvent,
|
CustomEvent, CustomRoomEvent, CustomStateEvent, EventType, InnerInvalidEvent, InvalidEvent,
|
||||||
};
|
};
|
||||||
|
|
||||||
use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer};
|
|
||||||
use serde_json::{from_value, Value};
|
|
||||||
|
|
||||||
/// A basic event, room event, or state event.
|
/// A basic event, room event, or state event.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
#[allow(clippy::large_enum_variant)]
|
#[allow(clippy::large_enum_variant)]
|
||||||
@ -396,6 +396,7 @@ impl FromStr for Event {
|
|||||||
type Err = InvalidEvent;
|
type Err = InvalidEvent;
|
||||||
|
|
||||||
/// Attempt to create `Self` from parsing a string of JSON data.
|
/// Attempt to create `Self` from parsing a string of JSON data.
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn from_str(json: &str) -> Result<Self, Self::Err> {
|
fn from_str(json: &str) -> Result<Self, Self::Err> {
|
||||||
let value: Value = serde_json::from_str(json)?;
|
let value: Value = serde_json::from_str(json)?;
|
||||||
|
|
||||||
@ -799,6 +800,7 @@ impl FromStr for RoomEvent {
|
|||||||
type Err = InvalidEvent;
|
type Err = InvalidEvent;
|
||||||
|
|
||||||
/// Attempt to create `Self` from parsing a string of JSON data.
|
/// Attempt to create `Self` from parsing a string of JSON data.
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn from_str(json: &str) -> Result<Self, Self::Err> {
|
fn from_str(json: &str) -> Result<Self, Self::Err> {
|
||||||
let value: Value = serde_json::from_str(json)?;
|
let value: Value = serde_json::from_str(json)?;
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
//! Enums for heterogeneous collections of events, exclusive to event types that implement "at
|
//! Enums for heterogeneous collections of events, exclusive to event types that implement "at
|
||||||
//! most" the trait of the same name.
|
//! most" the trait of the same name.
|
||||||
|
|
||||||
use std::{convert::TryFrom, str::FromStr};
|
use std::str::FromStr;
|
||||||
|
|
||||||
use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Serialize, Serializer};
|
||||||
use serde_json::{from_value, Value};
|
use serde_json::{from_value, Value};
|
||||||
|
|
||||||
pub use super::all::StateEvent;
|
pub use super::all::StateEvent;
|
||||||
@ -38,6 +38,7 @@ use crate::{
|
|||||||
|
|
||||||
/// A basic event.
|
/// A basic event.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
#[allow(clippy::large_enum_variant)]
|
||||||
pub enum Event {
|
pub enum Event {
|
||||||
/// m.direct
|
/// m.direct
|
||||||
Direct(DirectEvent),
|
Direct(DirectEvent),
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
use std::{convert::TryFrom, str::FromStr};
|
use std::{convert::TryFrom, str::FromStr};
|
||||||
|
|
||||||
use js_int::UInt;
|
use ruma_identifiers::DeviceId;
|
||||||
use ruma_identifiers::{DeviceId, EventId, RoomId, UserId};
|
|
||||||
use serde::{de::Error, ser::SerializeStruct, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{de::Error, ser::SerializeStruct, Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use serde_json::{from_value, Value};
|
use serde_json::{from_value, Value};
|
||||||
|
|
||||||
@ -11,7 +10,7 @@ use super::{
|
|||||||
HashAlgorithm, KeyAgreementProtocol, MessageAuthenticationCode, ShortAuthenticationString,
|
HashAlgorithm, KeyAgreementProtocol, MessageAuthenticationCode, ShortAuthenticationString,
|
||||||
VerificationMethod,
|
VerificationMethod,
|
||||||
};
|
};
|
||||||
use crate::{Algorithm, Event, EventType, InnerInvalidEvent, InvalidEvent, InvalidInput};
|
use crate::{Event, EventType, InnerInvalidEvent, InvalidEvent, InvalidInput};
|
||||||
|
|
||||||
/// Begins an SAS key verification process.
|
/// Begins an SAS key verification process.
|
||||||
///
|
///
|
||||||
@ -61,7 +60,7 @@ impl FromStr for StartEvent {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(Self { content: content })
|
Ok(Self { content })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,12 +387,11 @@ impl Serialize for MSasV1Content {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use serde_json::{from_str, to_string};
|
use serde_json::to_string;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
HashAlgorithm, KeyAgreementProtocol, MSasV1Content, MSasV1ContentOptions,
|
HashAlgorithm, KeyAgreementProtocol, MSasV1Content, MSasV1ContentOptions,
|
||||||
MessageAuthenticationCode, ShortAuthenticationString, StartEvent, StartEventContent,
|
MessageAuthenticationCode, ShortAuthenticationString, StartEvent, StartEventContent,
|
||||||
VerificationMethod,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -97,7 +97,7 @@
|
|||||||
|
|
||||||
#![deny(missing_debug_implementations)]
|
#![deny(missing_debug_implementations)]
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
#![allow(warnings)]
|
#![deny(warnings)]
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
error::Error,
|
error::Error,
|
||||||
|
@ -331,12 +331,10 @@ impl<'de> Deserialize<'de> for PushCondition {
|
|||||||
|
|
||||||
Ok(PushCondition::SenderNotificationPermission(condition))
|
Ok(PushCondition::SenderNotificationPermission(condition))
|
||||||
}
|
}
|
||||||
unknown_kind => {
|
unknown_kind => Err(D::Error::custom(&format!(
|
||||||
return Err(D::Error::custom(&format!(
|
"unknown condition kind `{}`",
|
||||||
"unknown condition kind `{}`",
|
unknown_kind
|
||||||
unknown_kind
|
))),
|
||||||
)))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,7 @@ use serde::{ser::SerializeStruct, Deserialize, Serialize, Serializer};
|
|||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
empty_string_as_none, Event, EventType, InnerInvalidEvent, InvalidEvent, InvalidInput,
|
empty_string_as_none, Event, EventType, InnerInvalidEvent, InvalidEvent, RoomEvent, StateEvent,
|
||||||
RoomEvent, StateEvent,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Informs the room as to which alias is the canonical one.
|
/// Informs the room as to which alias is the canonical one.
|
||||||
@ -231,8 +230,7 @@ mod tests {
|
|||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_identifiers::{EventId, RoomAliasId, RoomId, UserId};
|
use ruma_identifiers::{EventId, RoomAliasId, UserId};
|
||||||
use serde_json::Value;
|
|
||||||
|
|
||||||
use super::{CanonicalAliasEvent, CanonicalAliasEventContent};
|
use super::{CanonicalAliasEvent, CanonicalAliasEventContent};
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ use ruma_identifiers::{DeviceId, EventId, RoomId, UserId};
|
|||||||
use serde::{de::Error, ser::SerializeStruct, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{de::Error, ser::SerializeStruct, Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use serde_json::{from_value, Value};
|
use serde_json::{from_value, Value};
|
||||||
|
|
||||||
use crate::{Algorithm, Event, EventType, InnerInvalidEvent, InvalidEvent, RoomEvent, StateEvent};
|
use crate::{Algorithm, Event, EventType, InnerInvalidEvent, InvalidEvent, RoomEvent};
|
||||||
|
|
||||||
/// This event type is used when sending encrypted events.
|
/// This event type is used when sending encrypted events.
|
||||||
///
|
///
|
||||||
@ -83,7 +83,7 @@ impl FromStr for EncryptedEvent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
content: content,
|
content,
|
||||||
event_id: raw.event_id,
|
event_id: raw.event_id,
|
||||||
origin_server_ts: raw.origin_server_ts,
|
origin_server_ts: raw.origin_server_ts,
|
||||||
room_id: raw.room_id,
|
room_id: raw.room_id,
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use js_int::UInt;
|
|
||||||
use ruma_events_macros::ruma_event;
|
use ruma_events_macros::ruma_event;
|
||||||
use ruma_identifiers::UserId;
|
use ruma_identifiers::UserId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -12,7 +12,7 @@ use serde::{
|
|||||||
use serde_json::{from_value, Value};
|
use serde_json::{from_value, Value};
|
||||||
|
|
||||||
use super::{EncryptedFile, ImageInfo, ThumbnailInfo};
|
use super::{EncryptedFile, ImageInfo, ThumbnailInfo};
|
||||||
use crate::{Event, EventType, InnerInvalidEvent, InvalidEvent, InvalidInput, RoomEvent};
|
use crate::{Event, EventType, InnerInvalidEvent, InvalidEvent, RoomEvent};
|
||||||
|
|
||||||
pub mod feedback;
|
pub mod feedback;
|
||||||
|
|
||||||
@ -1107,7 +1107,7 @@ impl Serialize for VideoMessageEventContent {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use serde_json::to_string;
|
use serde_json::to_string;
|
||||||
|
|
||||||
use super::{AudioMessageEventContent, MessageEventContent, MessageType};
|
use super::{AudioMessageEventContent, MessageEventContent};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn serialization() {
|
fn serialization() {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
//! Types for the *m.room.message.feedback* event.
|
//! Types for the *m.room.message.feedback* event.
|
||||||
|
|
||||||
use js_int::UInt;
|
|
||||||
use ruma_events_macros::ruma_event;
|
use ruma_events_macros::ruma_event;
|
||||||
use ruma_identifiers::EventId;
|
use ruma_identifiers::EventId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -7,9 +7,7 @@ use ruma_identifiers::{EventId, RoomId, UserId};
|
|||||||
use serde::{ser::SerializeStruct, Deserialize, Serialize, Serializer};
|
use serde::{ser::SerializeStruct, Deserialize, Serialize, Serializer};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
use crate::{
|
use crate::{Event, EventType, InnerInvalidEvent, InvalidEvent, RoomEvent, StateEvent};
|
||||||
Event, EventType, InnerInvalidEvent, InvalidEvent, InvalidInput, RoomEvent, StateEvent,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Defines the power levels (privileges) of users in the room.
|
/// Defines the power levels (privileges) of users in the room.
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
use std::{convert::TryFrom, str::FromStr};
|
use std::{convert::TryFrom, str::FromStr};
|
||||||
|
|
||||||
use ruma_identifiers::UserId;
|
use ruma_identifiers::UserId;
|
||||||
use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Serialize, Serializer};
|
||||||
use serde_json::{from_value, to_string, Value};
|
use serde_json::{from_value, to_string, Value};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -393,7 +393,7 @@ mod tests {
|
|||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_identifiers::UserId;
|
use ruma_identifiers::UserId;
|
||||||
use serde_json::{from_str, to_string};
|
use serde_json::to_string;
|
||||||
|
|
||||||
use super::{StrippedRoomName, StrippedRoomTopic, StrippedState};
|
use super::{StrippedRoomName, StrippedRoomTopic, StrippedState};
|
||||||
use crate::{
|
use crate::{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user