Fix clippy warnings
This commit is contained in:
23
src/main.rs
23
src/main.rs
@ -83,37 +83,32 @@ async fn ensure_matrix_room_joined(matrix_client: &Client, room_id: &OwnedRoomOr
|
||||
|| a_room
|
||||
.canonical_alias()
|
||||
.iter()
|
||||
.find(|alias| alias.as_str() == our_room_str)
|
||||
.is_some()
|
||||
|| a_room
|
||||
.alt_aliases()
|
||||
.iter()
|
||||
.find(|alias| alias.as_str() == our_room_str)
|
||||
.is_some()
|
||||
.any(|alias| alias.as_str() == our_room_str)
|
||||
|| a_room.alt_aliases().iter().any(|alias| alias.as_str() == our_room_str)
|
||||
}
|
||||
|
||||
let mut room = matrix_client
|
||||
.joined_rooms()
|
||||
.iter()
|
||||
.find(|a_room| room_matches(*a_room, room_id))
|
||||
.map(|room| room.clone());
|
||||
.find(|a_room| room_matches(a_room, room_id))
|
||||
.cloned();
|
||||
if room.is_none() {
|
||||
if let Some(invited) = matrix_client
|
||||
.invited_rooms()
|
||||
.iter()
|
||||
.find(|a_room| room_matches(*a_room, room_id))
|
||||
.find(|a_room| room_matches(a_room, room_id))
|
||||
{
|
||||
invited.accept_invitation().await?;
|
||||
} else {
|
||||
matrix_client.join_room_by_id_or_alias(room_id, &[]).await?;
|
||||
}
|
||||
let settings = build_sync_settings(&matrix_client).await;
|
||||
let settings = build_sync_settings(matrix_client).await;
|
||||
matrix_client.sync_once(settings).await?;
|
||||
room = matrix_client
|
||||
.joined_rooms()
|
||||
.iter()
|
||||
.find(|a_room| room_matches(*a_room, room_id))
|
||||
.map(|room| room.clone());
|
||||
.find(|a_room| room_matches(a_room, room_id))
|
||||
.cloned();
|
||||
}
|
||||
|
||||
room.ok_or_else(|| anyhow!("Unable to join room {}", room_id))
|
||||
@ -162,7 +157,7 @@ async fn run() -> anyhow::Result<()> {
|
||||
let addr = config
|
||||
.bind_address
|
||||
.as_ref()
|
||||
.map(|ba| ba.clone())
|
||||
.cloned()
|
||||
.unwrap_or_else(|| "127.0.0.1".to_string())
|
||||
.parse::<IpAddr>()
|
||||
.context("Failed to parse bind_address")?;
|
||||
|
Reference in New Issue
Block a user