Private
Public Access
1
0

cargo clippy/fix

This commit is contained in:
2025-04-28 16:06:51 -07:00
parent c189e5f9e3
commit e7d837d68c
13 changed files with 43 additions and 61 deletions

View File

@@ -9,7 +9,6 @@ use crate::daemon::{
DaemonResult,
events::{Event, Reply},
settings::Settings,
signals::Signal,
};
use crate::dbus::interface::NetBuzzertKordophoneRepository as DbusRepository;
@@ -54,9 +53,11 @@ impl DbusRepository for ServerImpl {
fn get_conversations(&mut self) -> Result<Vec<arg::PropMap>, dbus::MethodErr> {
self.send_event_sync(Event::GetAllConversations)
.and_then(|conversations| {
.map(|conversations| {
// Convert conversations to DBus property maps
let result = conversations.into_iter().map(|conv| {
conversations.into_iter().map(|conv| {
let mut map = arg::PropMap::new();
map.insert("guid".into(), arg::Variant(Box::new(conv.guid)));
map.insert("display_name".into(), arg::Variant(Box::new(conv.display_name.unwrap_or_default())));
@@ -65,9 +66,7 @@ impl DbusRepository for ServerImpl {
map.insert("participants".into(), arg::Variant(Box::new(conv.participants.into_iter().map(|p| p.display_name()).collect::<Vec<String>>())));
map.insert("date".into(), arg::Variant(Box::new(conv.date.and_utc().timestamp())));
map
}).collect();
Ok(result)
}).collect()
})
}
@@ -83,17 +82,17 @@ impl DbusRepository for ServerImpl {
};
self.send_event_sync(|r| Event::GetMessages(conversation_id, last_message_id_opt, r))
.and_then(|messages| {
let result = messages.into_iter().map(|msg| {
.map(|messages| {
messages.into_iter().map(|msg| {
let mut map = arg::PropMap::new();
map.insert("id".into(), arg::Variant(Box::new(msg.id)));
map.insert("text".into(), arg::Variant(Box::new(msg.text)));
map.insert("date".into(), arg::Variant(Box::new(msg.date.and_utc().timestamp())));
map.insert("sender".into(), arg::Variant(Box::new(msg.sender.display_name())));
map
}).collect();
Ok(result)
}).collect()
})
}
}
@@ -121,9 +120,7 @@ impl DbusSettings for ServerImpl {
fn server_url(&self) -> Result<String, dbus::MethodErr> {
self.send_event_sync(Event::GetAllSettings)
.and_then(|settings| {
Ok(settings.server_url.unwrap_or_default())
})
.map(|settings| settings.server_url.unwrap_or_default())
}
fn set_server_url(&self, value: String) -> Result<(), dbus::MethodErr> {
@@ -138,9 +135,7 @@ impl DbusSettings for ServerImpl {
fn username(&self) -> Result<String, dbus::MethodErr> {
self.send_event_sync(Event::GetAllSettings)
.and_then(|settings| {
Ok(settings.username.unwrap_or_default())
})
.map(|settings| settings.username.unwrap_or_default())
}
fn set_username(&self, value: String) -> Result<(), dbus::MethodErr> {
@@ -155,12 +150,7 @@ impl DbusSettings for ServerImpl {
fn credential_item(&self) -> Result<dbus::Path<'static>, dbus::MethodErr> {
self.send_event_sync(Event::GetAllSettings)
.and_then(|settings| {
Ok(settings.credential_item.unwrap_or_default())
})
.and_then(|item| {
Ok(dbus::Path::new(item).unwrap_or_default())
})
.map(|settings| settings.credential_item.unwrap_or_default()).map(|item| dbus::Path::new(item).unwrap_or_default())
}
fn set_credential_item(&self, value: dbus::Path<'static>) -> Result<(), dbus::MethodErr> {