Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
rumpelsepp committed Feb 2, 2024
1 parent da47240 commit 7ab0304
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/client/sas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ impl super::Client {
let Some(request) = client
.encryption()
.get_verification_request(&ev.sender, &ev.event_id)
.await else {
.await
else {
tracing::warn!("creating verification request failed");
return;
};

let Ok(()) = request
.accept().await else {
let Ok(()) = request.accept().await else {
tracing::warn!("can't accept verification request");
return;
};
Expand Down
7 changes: 5 additions & 2 deletions src/client/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use std::os::unix::fs::PermissionsExt;
use std::path::{Path, PathBuf};

use anyhow::bail;
use matrix_sdk::ruma::{OwnedUserId, UserId};
use matrix_sdk::matrix_auth::MatrixSession;
use matrix_sdk::ruma::{OwnedUserId, UserId};
use serde::{Deserialize, Serialize};
use tracing::error;

Expand Down Expand Up @@ -65,7 +65,10 @@ fn persist_session_json(path: impl AsRef<Path>, session: &MatrixSession) -> anyh
Ok(())
}

fn persist_session_keyring(user_id: impl AsRef<UserId>, session: &MatrixSession) -> anyhow::Result<()> {
fn persist_session_keyring(
user_id: impl AsRef<UserId>,
session: &MatrixSession,
) -> anyhow::Result<()> {
let entry = keyring::Entry::new(CRATE_NAME, user_id.as_ref().as_str())?;
entry.set_password(&serde_json::to_string(session)?)?;
Ok(())
Expand Down
16 changes: 5 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ async fn on_room_message(
receipt: bool,
) -> anyhow::Result<()> {
match room.state() {
RoomState::Joined => {},
_ => return Ok(())
RoomState::Joined => {}
_ => return Ok(()),
}

let raw_json = event.clone().into_json();
Expand Down Expand Up @@ -310,25 +310,19 @@ async fn main() -> anyhow::Result<()> {

println!("{}", serde_json::to_string(&events)?);
}
Command::Rooms { room_id} => {
Command::Rooms { room_id } => {
let out = match room_id {
Some(room_id) => {
let Some(room) = client.get_room(&room_id) else {
bail!("no such room: {}", room_id);
};
let output = client
.query_room(room)
.await?;
let output = client.query_room(room).await?;
serde_json::to_string(&output)?
}
None => {
let mut output = vec![];
for room in client.rooms() {
output.push(
client
.query_room(room)
.await?,
);
output.push(client.query_room(room).await?);
}
serde_json::to_string(&output)?
}
Expand Down

0 comments on commit 7ab0304

Please sign in to comment.