aboutsummaryrefslogtreecommitdiff
path: root/src/message/signalproxy
diff options
context:
space:
mode:
authorMax Audron <me@audron.dev>2026-02-21 14:35:01 +0100
committerMax Audron <me@audron.dev>2026-02-21 14:35:01 +0100
commitf42ef4bec6d1c63c0d8564cfb06e996666dedbe3 (patch)
treee526bf4cae5ecf798469acc157b14122d4a5e25a /src/message/signalproxy
parentreplace all match_variant instances with try_into (diff)
clean up clippy lints
Diffstat (limited to '')
-rw-r--r--src/message/signalproxy/heartbeat.rs26
-rw-r--r--src/message/signalproxy/initdata.rs2
-rw-r--r--src/message/signalproxy/initrequest.rs15
-rw-r--r--src/message/signalproxy/mod.rs18
-rw-r--r--src/message/signalproxy/objects/bufferviewmanager.rs26
-rw-r--r--src/message/signalproxy/objects/coreinfo.rs1
-rw-r--r--src/message/signalproxy/objects/highlightrulemanager.rs2
-rw-r--r--src/message/signalproxy/objects/identity.rs2
-rw-r--r--src/message/signalproxy/objects/ircchannel.rs4
-rw-r--r--src/message/signalproxy/objects/ircuser.rs2
-rw-r--r--src/message/signalproxy/objects/mod.rs62
-rw-r--r--src/message/signalproxy/objects/network.rs39
-rw-r--r--src/message/signalproxy/objects/networkinfo.rs2
-rw-r--r--src/message/signalproxy/rpccall/client.rs2
-rw-r--r--src/message/signalproxy/rpccall/identity.rs4
-rw-r--r--src/message/signalproxy/rpccall/mod.rs4
-rw-r--r--src/message/signalproxy/rpccall/network.rs6
-rw-r--r--src/message/signalproxy/rpccall/passwordchange.rs6
-rw-r--r--src/message/signalproxy/syncmessage.rs12
19 files changed, 113 insertions, 122 deletions
diff --git a/src/message/signalproxy/heartbeat.rs b/src/message/signalproxy/heartbeat.rs
index 7bb5b19..e7d17f3 100644
--- a/src/message/signalproxy/heartbeat.rs
+++ b/src/message/signalproxy/heartbeat.rs
@@ -10,18 +10,17 @@ pub struct HeartBeat {
impl Serialize for HeartBeat {
fn serialize(&self) -> Result<Vec<std::primitive::u8>, ProtocolError> {
- let mut res = VariantList::new();
-
- res.push(Variant::i32(MessageType::HeartBeat as i32));
- res.push(Variant::DateTime(self.timestamp.clone()));
-
- res.serialize()
+ vec![
+ Variant::i32(MessageType::HeartBeat as i32),
+ Variant::DateTime(self.timestamp),
+ ]
+ .serialize()
}
}
impl Deserialize for HeartBeat {
fn parse(b: &[std::primitive::u8]) -> Result<(std::primitive::usize, Self), ProtocolError> {
- let (size, mut res) = VariantList::parse(&b)?;
+ let (size, mut res) = VariantList::parse(b)?;
res.remove(0);
@@ -41,18 +40,17 @@ pub struct HeartBeatReply {
impl Serialize for HeartBeatReply {
fn serialize(&self) -> Result<Vec<std::primitive::u8>, ProtocolError> {
- let mut res = VariantList::new();
-
- res.push(Variant::i32(MessageType::HeartBeatReply as i32));
- res.push(Variant::DateTime(self.timestamp.clone()));
-
- res.serialize()
+ vec![
+ Variant::i32(MessageType::HeartBeatReply as i32),
+ Variant::DateTime(self.timestamp),
+ ]
+ .serialize()
}
}
impl Deserialize for HeartBeatReply {
fn parse(b: &[std::primitive::u8]) -> Result<(std::primitive::usize, Self), ProtocolError> {
- let (size, mut res) = VariantList::parse(&b)?;
+ let (size, mut res) = VariantList::parse(b)?;
res.remove(0);
diff --git a/src/message/signalproxy/initdata.rs b/src/message/signalproxy/initdata.rs
index f95e0b2..c2ca6c6 100644
--- a/src/message/signalproxy/initdata.rs
+++ b/src/message/signalproxy/initdata.rs
@@ -28,7 +28,7 @@ impl Serialize for InitData {
impl Deserialize for InitData {
fn parse(b: &[u8]) -> Result<(usize, Self), ProtocolError> {
- let (size, mut res) = VariantList::parse(&b)?;
+ let (size, mut res) = VariantList::parse(b)?;
res.remove(0);
diff --git a/src/message/signalproxy/initrequest.rs b/src/message/signalproxy/initrequest.rs
index bf2f200..592a703 100644
--- a/src/message/signalproxy/initrequest.rs
+++ b/src/message/signalproxy/initrequest.rs
@@ -11,19 +11,18 @@ pub struct InitRequest {
impl Serialize for InitRequest {
fn serialize(&self) -> Result<Vec<std::primitive::u8>, ProtocolError> {
- let mut res = VariantList::new();
-
- res.push(Variant::i32(MessageType::InitRequest as i32));
- res.push(Variant::ByteArray(self.class_name.clone()));
- res.push(Variant::ByteArray(self.object_name.clone()));
-
- res.serialize()
+ vec![
+ Variant::i32(MessageType::InitRequest as i32),
+ Variant::ByteArray(self.class_name.clone()),
+ Variant::ByteArray(self.object_name.clone()),
+ ]
+ .serialize()
}
}
impl Deserialize for InitRequest {
fn parse(b: &[std::primitive::u8]) -> Result<(std::primitive::usize, Self), ProtocolError> {
- let (size, mut res) = VariantList::parse(&b)?;
+ let (size, mut res) = VariantList::parse(b)?;
res.remove(0);
diff --git a/src/message/signalproxy/mod.rs b/src/message/signalproxy/mod.rs
index 5107e9b..90cf7e5 100644
--- a/src/message/signalproxy/mod.rs
+++ b/src/message/signalproxy/mod.rs
@@ -131,6 +131,7 @@ where
where
Self: Sized,
{
+ #[allow(clippy::match_single_binding)]
match msg.slot_name.as_str() {
_ => (),
}
@@ -170,6 +171,7 @@ pub trait StatefulSyncableClient: Syncable + translation::NetworkMap {
where
Self: Sized,
{
+ #[allow(clippy::match_single_binding)]
match msg.slot_name.as_str() {
_ => (),
}
@@ -199,7 +201,7 @@ pub enum Message {
/// Bidirectional
RpcCall(RpcCall),
InitRequest(InitRequest),
- InitData(InitData),
+ InitData(Box<InitData>),
/// Bidirectional
HeartBeat(HeartBeat),
/// Bidirectional
@@ -238,32 +240,32 @@ impl Deserialize for Message {
match MessageType::from(message_type) {
MessageType::SyncMessage => {
- let (size, res) = SyncMessage::parse(&b)?;
+ let (size, res) = SyncMessage::parse(b)?;
Ok((size, Message::SyncMessage(res)))
}
MessageType::RpcCall => {
- let (size, res) = RpcCall::parse(&b)?;
+ let (size, res) = RpcCall::parse(b)?;
Ok((size, Message::RpcCall(res)))
}
MessageType::InitRequest => {
- let (size, res) = InitRequest::parse(&b)?;
+ let (size, res) = InitRequest::parse(b)?;
Ok((size, Message::InitRequest(res)))
}
MessageType::InitData => {
- let (size, res) = InitData::parse(&b)?;
+ let (size, res) = InitData::parse(b)?;
- Ok((size, Message::InitData(res)))
+ Ok((size, Message::InitData(Box::new(res))))
}
MessageType::HeartBeat => {
- let (size, res) = HeartBeat::parse(&b)?;
+ let (size, res) = HeartBeat::parse(b)?;
Ok((size, Message::HeartBeat(res)))
}
MessageType::HeartBeatReply => {
- let (size, res) = HeartBeatReply::parse(&b)?;
+ let (size, res) = HeartBeatReply::parse(b)?;
Ok((size, Message::HeartBeatReply(res)))
}
diff --git a/src/message/signalproxy/objects/bufferviewmanager.rs b/src/message/signalproxy/objects/bufferviewmanager.rs
index 683d937..1097ade 100644
--- a/src/message/signalproxy/objects/bufferviewmanager.rs
+++ b/src/message/signalproxy/objects/bufferviewmanager.rs
@@ -133,23 +133,16 @@ impl Syncable for BufferViewManager {
impl super::NetworkList for BufferViewManager {
fn to_network_list(&self) -> VariantList {
- let mut res = Vec::with_capacity(2);
-
- res.push(Variant::ByteArray(s!("bufferViewIds")));
- res.push(Variant::VariantList(
- self.buffer_view_configs
- .iter()
- .map(|(k, _)| i32::try_into(*k).unwrap())
- .collect(),
- ));
-
- return res;
+ vec![
+ Variant::ByteArray(s!("bufferViewIds")),
+ Variant::VariantList(self.buffer_view_configs.keys().map(|k| i32::into(*k)).collect()),
+ ]
}
fn from_network_list(input: &mut VariantList) -> Self {
let mut i = input.iter();
i.position(|x| *x == Variant::ByteArray(String::from("BufferViewIds")))
- .expect(format!("failed to get field BufferViewIds").as_str());
+ .expect("failed to get field BufferViewIds");
let ids = match i.next().expect("failed to get next field") {
libquassel::primitive::Variant::VariantList(var) => var.clone(),
@@ -174,15 +167,10 @@ impl super::NetworkMap for BufferViewManager {
res.insert(
s!("bufferViewIds"),
- Variant::VariantList(
- self.buffer_view_configs
- .iter()
- .map(|(k, _)| i32::try_into(*k).unwrap())
- .collect(),
- ),
+ Variant::VariantList(self.buffer_view_configs.keys().map(|k| i32::into(*k)).collect()),
);
- return res;
+ res
}
fn from_network_map(_input: &mut Self::Item) -> Self {
diff --git a/src/message/signalproxy/objects/coreinfo.rs b/src/message/signalproxy/objects/coreinfo.rs
index 4567762..5036abd 100644
--- a/src/message/signalproxy/objects/coreinfo.rs
+++ b/src/message/signalproxy/objects/coreinfo.rs
@@ -26,6 +26,7 @@ impl crate::message::StatefulSyncableClient for CoreInfo {
where
Self: Sized,
{
+ #[allow(clippy::single_match)]
match msg.slot_name.as_str() {
"setCoreData" => self.set_core_data(CoreData::from_network_map(&mut get_param!(msg))),
_ => (),
diff --git a/src/message/signalproxy/objects/highlightrulemanager.rs b/src/message/signalproxy/objects/highlightrulemanager.rs
index 0f1569a..7accb17 100644
--- a/src/message/signalproxy/objects/highlightrulemanager.rs
+++ b/src/message/signalproxy/objects/highlightrulemanager.rs
@@ -223,8 +223,10 @@ impl From<HighlightNickType> for Variant {
}
}
+// TODO error handling
impl From<Variant> for HighlightNickType {
fn from(value: Variant) -> Self {
+ #[allow(clippy::unnecessary_fallible_conversions)]
HighlightNickType::try_from(value).unwrap()
}
}
diff --git a/src/message/signalproxy/objects/identity.rs b/src/message/signalproxy/objects/identity.rs
index 6aa9830..ec7d9b4 100644
--- a/src/message/signalproxy/objects/identity.rs
+++ b/src/message/signalproxy/objects/identity.rs
@@ -81,7 +81,7 @@ impl Deserialize for Identity {
Self: std::marker::Sized,
{
let (vlen, mut value) = VariantMap::parse(b)?;
- return Ok((vlen, Self::from_network_map(&mut value)));
+ Ok((vlen, Self::from_network_map(&mut value)))
}
}
diff --git a/src/message/signalproxy/objects/ircchannel.rs b/src/message/signalproxy/objects/ircchannel.rs
index 9ca3474..9648210 100644
--- a/src/message/signalproxy/objects/ircchannel.rs
+++ b/src/message/signalproxy/objects/ircchannel.rs
@@ -47,7 +47,7 @@ impl Deserialize for IrcChannel {
Self: std::marker::Sized,
{
let (vlen, mut value) = VariantMap::parse(b)?;
- return Ok((vlen, Self::from_network_map(&mut value)));
+ Ok((vlen, Self::from_network_map(&mut value)))
}
}
@@ -155,7 +155,7 @@ impl IrcChannel {
None => warn!("tried to remove a user that is not joined to the channel"),
}
- if self.user_modes.len() == 0
+ if self.user_modes.is_empty()
/* nick.is_me() */
{
// TODO Clean up channel and delete
diff --git a/src/message/signalproxy/objects/ircuser.rs b/src/message/signalproxy/objects/ircuser.rs
index 1969793..3b807ed 100644
--- a/src/message/signalproxy/objects/ircuser.rs
+++ b/src/message/signalproxy/objects/ircuser.rs
@@ -59,7 +59,7 @@ impl Deserialize for IrcUser {
Self: std::marker::Sized,
{
let (vlen, mut value) = VariantMap::parse(b)?;
- return Ok((vlen, Self::from_network_map(&mut value)));
+ Ok((vlen, Self::from_network_map(&mut value)))
}
}
diff --git a/src/message/signalproxy/objects/mod.rs b/src/message/signalproxy/objects/mod.rs
index 0fb16c6..999cd41 100644
--- a/src/message/signalproxy/objects/mod.rs
+++ b/src/message/signalproxy/objects/mod.rs
@@ -60,20 +60,20 @@ use crate::primitive::VariantList;
// TODO Handle SyncedCoreInfo feature flag
#[derive(Debug, Clone, PartialEq, From)]
pub enum Types {
- AliasManager(AliasManager),
- BufferSyncer(BufferSyncer),
- BufferViewConfig(BufferViewConfig),
- BufferViewManager(BufferViewManager),
- // CoreInfo(CoreInfo),
- CoreData(CoreData),
- HighlightRuleManager(HighlightRuleManager),
- IgnoreListManager(IgnoreListManager),
- CertManager(CertManager),
- Network(network::Network),
- NetworkInfo(NetworkInfo),
- NetworkConfig(NetworkConfig),
- IrcChannel(IrcChannel),
- Unknown(VariantList),
+ AliasManager(Box<AliasManager>),
+ BufferSyncer(Box<BufferSyncer>),
+ BufferViewConfig(Box<BufferViewConfig>),
+ BufferViewManager(Box<BufferViewManager>),
+ // CoreInfo(Box< CoreInfo >),
+ CoreData(Box<CoreData>),
+ HighlightRuleManager(Box<HighlightRuleManager>),
+ IgnoreListManager(Box<IgnoreListManager>),
+ CertManager(Box<CertManager>),
+ Network(Box<network::Network>),
+ NetworkInfo(Box<NetworkInfo>),
+ NetworkConfig(Box<NetworkConfig>),
+ IrcChannel(Box<IrcChannel>),
+ Unknown(Box<VariantList>),
}
impl Types {
@@ -93,37 +93,41 @@ impl Types {
Types::NetworkInfo(val) => val.to_network_list(),
Types::NetworkConfig(val) => val.to_network_list(),
Types::IrcChannel(val) => val.to_network_list(),
- Types::Unknown(val) => val.clone(),
+ Types::Unknown(val) => *val.clone(),
}
}
pub fn from_network(class_name: &str, object_name: &str, input: &mut VariantList) -> Self {
debug!("converting {} from network object: {:#?}", class_name, input);
match class_name {
- "AliasManager" => Types::AliasManager(AliasManager::from_network_list(input)),
- "BufferSyncer" => Types::BufferSyncer(BufferSyncer::from_network_list(input)),
+ "AliasManager" => Types::AliasManager(Box::new(AliasManager::from_network_list(input))),
+ "BufferSyncer" => Types::BufferSyncer(Box::new(BufferSyncer::from_network_list(input))),
"BufferViewConfig" => {
let mut config = BufferViewConfig::from_network_list(input);
config.buffer_view_id = object_name.parse().unwrap();
- Types::BufferViewConfig(config)
+ Types::BufferViewConfig(Box::new(config))
+ }
+ "BufferViewManager" => {
+ Types::BufferViewManager(Box::new(BufferViewManager::from_network_list(input)))
}
- "BufferViewManager" => Types::BufferViewManager(BufferViewManager::from_network_list(input)),
// "CoreInfo" => Types::CoreInfo(CoreInfo::from_network_map(
// &mut input.remove(0).try_into().unwrap(),
// )),
- "CoreData" => Types::CoreData(CoreData::from_network_map(
+ "CoreData" => Types::CoreData(Box::new(CoreData::from_network_map(
&mut input.remove(0).try_into().unwrap(),
- )),
+ ))),
"HighlightRuleManager" => {
- Types::HighlightRuleManager(HighlightRuleManager::from_network_list(input))
+ Types::HighlightRuleManager(Box::new(HighlightRuleManager::from_network_list(input)))
+ }
+ "IgnoreListManager" => {
+ Types::IgnoreListManager(Box::new(IgnoreListManager::from_network_list(input)))
}
- "IgnoreListManager" => Types::IgnoreListManager(IgnoreListManager::from_network_list(input)),
- "CertManager" => Types::CertManager(CertManager::from_network_list(input)),
- "Network" => Types::Network(Network::from_network_list(input)),
- "NetworkInfo" => Types::NetworkInfo(NetworkInfo::from_network_list(input)),
- "NetworkConfig" => Types::NetworkConfig(NetworkConfig::from_network_list(input)),
- "IrcChannel" => Types::IrcChannel(IrcChannel::from_network_list(input)),
- _ => Types::Unknown(input.to_owned()),
+ "CertManager" => Types::CertManager(Box::new(CertManager::from_network_list(input))),
+ "Network" => Types::Network(Box::new(Network::from_network_list(input))),
+ "NetworkInfo" => Types::NetworkInfo(Box::new(NetworkInfo::from_network_list(input))),
+ "NetworkConfig" => Types::NetworkConfig(Box::new(NetworkConfig::from_network_list(input))),
+ "IrcChannel" => Types::IrcChannel(Box::new(IrcChannel::from_network_list(input))),
+ _ => Types::Unknown(Box::new(input.to_owned())),
}
}
}
diff --git a/src/message/signalproxy/objects/network.rs b/src/message/signalproxy/objects/network.rs
index a606537..3d2ee8b 100644
--- a/src/message/signalproxy/objects/network.rs
+++ b/src/message/signalproxy/objects/network.rs
@@ -71,23 +71,19 @@ impl Network {
let default_prefixes = vec!['~', '&', '@', '%', '+'];
let default_prefix_modes = vec!['q', 'a', 'o', 'h', 'v'];
- match self.supports.get("PREFIX") {
- Some(prefix) => {
- if prefix.starts_with('(') {
- let (prefix_modes, prefixes) = prefix[1..].split_once(')').unwrap();
-
- self.prefix_modes = prefix_modes.chars().collect();
- self.prefixes = prefixes.chars().collect();
- } else {
- self.prefixes = default_prefixes;
- self.prefix_modes = default_prefix_modes;
- }
- }
- None => {
- self.prefixes = default_prefixes;
- self.prefix_modes = default_prefix_modes;
+ if let Some(prefix) = self.supports.get("PREFIX") {
+ if let Some(prefix) = prefix.strip_prefix('(') {
+ let (prefix_modes, prefixes) = prefix.split_once(')').unwrap();
+
+ self.prefix_modes = prefix_modes.chars().collect();
+ self.prefixes = prefixes.chars().collect();
+
+ return;
}
}
+
+ self.prefixes = default_prefixes;
+ self.prefix_modes = default_prefix_modes;
}
pub fn add_channel(&mut self, name: &str, channel: IrcChannel) {
@@ -280,6 +276,7 @@ impl crate::message::StatefulSyncableServer for Network {
impl crate::message::signalproxy::NetworkList for Network {
fn to_network_list(&self) -> VariantList {
+ #![allow(clippy::vec_init_then_push)]
let mut res = VariantList::new();
res.push(Variant::ByteArray(s!("myNick")));
@@ -449,7 +446,7 @@ impl crate::message::signalproxy::NetworkList for Network {
network.determine_channel_mode_types();
network.determine_prefixes();
- return network;
+ network
}
}
@@ -526,7 +523,7 @@ impl crate::message::signalproxy::NetworkMap for Network {
res.extend(self.network_info.to_network_map());
- return res;
+ res
}
fn from_network_map(input: &mut Self::Item) -> Self {
@@ -648,7 +645,7 @@ impl Deserialize for NetworkServer {
Self: std::marker::Sized,
{
let (vlen, mut value) = VariantMap::parse(b)?;
- return Ok((vlen, Self::from_network_map(&mut value)));
+ Ok((vlen, Self::from_network_map(&mut value)))
}
}
@@ -802,9 +799,9 @@ impl Default for ConnectionState {
}
}
-impl Into<Variant> for ConnectionState {
- fn into(self) -> Variant {
- Variant::i32(self.to_i32().unwrap())
+impl From<ConnectionState> for Variant {
+ fn from(val: ConnectionState) -> Self {
+ Variant::i32(val.to_i32().unwrap())
}
}
diff --git a/src/message/signalproxy/objects/networkinfo.rs b/src/message/signalproxy/objects/networkinfo.rs
index 4cd84dc..ba944e8 100644
--- a/src/message/signalproxy/objects/networkinfo.rs
+++ b/src/message/signalproxy/objects/networkinfo.rs
@@ -88,7 +88,7 @@ impl Deserialize for NetworkInfo {
Self: std::marker::Sized,
{
let (vlen, mut value) = VariantMap::parse(b)?;
- return Ok((vlen, Self::from_network_map(&mut value)));
+ Ok((vlen, Self::from_network_map(&mut value)))
}
}
diff --git a/src/message/signalproxy/rpccall/client.rs b/src/message/signalproxy/rpccall/client.rs
index 818b32c..7e31135 100644
--- a/src/message/signalproxy/rpccall/client.rs
+++ b/src/message/signalproxy/rpccall/client.rs
@@ -15,7 +15,7 @@ impl RpcCallType for KickClient {
fn to_network(&self) -> Result<Vec<crate::primitive::Variant>, crate::ProtocolError> {
Ok(vec![
Variant::ByteArray(Self::NAME.to_string()),
- self.id.clone().into(),
+ self.id.into(),
])
}
diff --git a/src/message/signalproxy/rpccall/identity.rs b/src/message/signalproxy/rpccall/identity.rs
index 1672e98..15beec4 100644
--- a/src/message/signalproxy/rpccall/identity.rs
+++ b/src/message/signalproxy/rpccall/identity.rs
@@ -54,7 +54,7 @@ impl RpcCallType for RemoveIdentity {
fn to_network(&self) -> Result<Vec<crate::primitive::Variant>, crate::ProtocolError> {
Ok(vec![
Variant::ByteArray(Self::NAME.to_string()),
- Variant::IdentityId(self.identity_id.clone()),
+ Variant::IdentityId(self.identity_id),
])
}
@@ -120,7 +120,7 @@ impl RpcCallType for IdentityRemoved {
fn to_network(&self) -> Result<Vec<crate::primitive::Variant>, crate::ProtocolError> {
Ok(vec![
Variant::ByteArray(Self::NAME.to_string()),
- Variant::IdentityId(self.identity_id.clone()),
+ Variant::IdentityId(self.identity_id),
])
}
diff --git a/src/message/signalproxy/rpccall/mod.rs b/src/message/signalproxy/rpccall/mod.rs
index c30d462..2a3e7b1 100644
--- a/src/message/signalproxy/rpccall/mod.rs
+++ b/src/message/signalproxy/rpccall/mod.rs
@@ -106,7 +106,7 @@ impl Serialize for RpcCall {
impl Deserialize for RpcCall {
fn parse(b: &[std::primitive::u8]) -> Result<(std::primitive::usize, Self), ProtocolError> {
- let (size, mut res) = VariantList::parse(&b)?;
+ let (size, mut res) = VariantList::parse(b)?;
res.remove(0);
@@ -130,7 +130,7 @@ impl Deserialize for RpcCall {
DisconnectFromCore::NAME => DisconnectFromCore::from_network(size, &mut res),
ObjectRenamed::NAME => ObjectRenamed::from_network(size, &mut res),
BufferInfoUpdated::NAME => BufferInfoUpdated::from_network(size, &mut res),
- _ => return Ok((size, RpcCall::NotImplemented)),
+ _ => Ok((size, RpcCall::NotImplemented)),
}
}
}
diff --git a/src/message/signalproxy/rpccall/network.rs b/src/message/signalproxy/rpccall/network.rs
index aeb3f80..738dddf 100644
--- a/src/message/signalproxy/rpccall/network.rs
+++ b/src/message/signalproxy/rpccall/network.rs
@@ -53,7 +53,7 @@ impl RpcCallType for RemoveNetwork {
fn to_network(&self) -> Result<Vec<crate::primitive::Variant>, crate::ProtocolError> {
Ok(vec![
Variant::ByteArray(Self::NAME.to_string()),
- self.network_id.clone().into(),
+ self.network_id.into(),
])
}
@@ -86,7 +86,7 @@ impl RpcCallType for NetworkCreated {
fn to_network(&self) -> Result<Vec<crate::primitive::Variant>, crate::ProtocolError> {
Ok(vec![
Variant::ByteArray(Self::NAME.to_string()),
- self.network_id.clone().into(),
+ self.network_id.into(),
])
}
@@ -119,7 +119,7 @@ impl RpcCallType for NetworkRemoved {
fn to_network(&self) -> Result<Vec<crate::primitive::Variant>, crate::ProtocolError> {
Ok(vec![
Variant::ByteArray(Self::NAME.to_string()),
- self.network_id.clone().into(),
+ self.network_id.into(),
])
}
diff --git a/src/message/signalproxy/rpccall/passwordchange.rs b/src/message/signalproxy/rpccall/passwordchange.rs
index b96b926..16bf78f 100644
--- a/src/message/signalproxy/rpccall/passwordchange.rs
+++ b/src/message/signalproxy/rpccall/passwordchange.rs
@@ -21,7 +21,7 @@ impl RpcCallType for ChangePassword {
fn to_network(&self) -> Result<Vec<crate::primitive::Variant>, crate::ProtocolError> {
Ok(vec![
Variant::ByteArray(Self::NAME.to_string()),
- self.peer.clone().into(),
+ self.peer.into(),
self.user.clone().into(),
self.before.clone().into(),
self.after.clone().into(),
@@ -64,8 +64,8 @@ impl RpcCallType for PasswordChanged {
fn to_network(&self) -> Result<Vec<crate::primitive::Variant>, crate::ProtocolError> {
Ok(vec![
Variant::ByteArray(Self::NAME.to_string()),
- self.peer.clone().into(),
- self.success.clone().into(),
+ self.peer.into(),
+ self.success.into(),
])
}
diff --git a/src/message/signalproxy/syncmessage.rs b/src/message/signalproxy/syncmessage.rs
index bb61d7c..b124d07 100644
--- a/src/message/signalproxy/syncmessage.rs
+++ b/src/message/signalproxy/syncmessage.rs
@@ -90,12 +90,12 @@ pub struct SyncMessage {
impl Serialize for SyncMessage {
fn serialize(&self) -> Result<Vec<std::primitive::u8>, ProtocolError> {
- let mut res = VariantList::new();
-
- res.push(Variant::i32(MessageType::SyncMessage as i32));
- res.push(Variant::ByteArray(self.class_name.as_str().to_owned()));
- res.push(Variant::ByteArray(self.object_name.clone()));
- res.push(Variant::ByteArray(self.slot_name.clone()));
+ let mut res = vec![
+ Variant::i32(MessageType::SyncMessage as i32),
+ Variant::ByteArray(self.class_name.as_str().to_owned()),
+ Variant::ByteArray(self.object_name.clone()),
+ Variant::ByteArray(self.slot_name.clone()),
+ ];
res.append(&mut self.params.clone());