From 61ec4e5fa7bad3391fc1898a9c3979a1f9b42563 Mon Sep 17 00:00:00 2001 From: "Taylor C. Richberger" Date: Thu, 16 Apr 2020 23:25:13 -0600 Subject: [PATCH] cargo fmt --- src/main.rs | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/main.rs b/src/main.rs index d2c3ccb..68183af 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,16 +1,14 @@ -use tokio::select; -use tokio::signal::unix::{SignalKind, signal}; -use std::env; +use serde::{self, Deserialize, Serialize}; use std::collections::HashMap; -use serde::{self, Serialize, Deserialize}; +use std::env; +use tokio::select; +use tokio::signal::unix::{signal, SignalKind}; #[derive(Serialize, Deserialize, Debug)] #[serde(tag = "msgtype")] enum MessageContent { #[serde(rename = "m.text")] - Text { - body: String, - }, + Text { body: String }, #[serde(other)] Other, @@ -77,10 +75,13 @@ struct SyncCommand { } async fn sync>(key: S) -> Result<(), Box> { - let body = reqwest::get(&format!("https://matrix.org/_matrix/client/r0/sync?access_token={}&timeout=3000", key.as_ref())) - .await? - .text() - .await?; + let body = reqwest::get(&format!( + "https://matrix.org/_matrix/client/r0/sync?access_token={}&timeout=3000", + key.as_ref() + )) + .await? + .text() + .await?; let sync: SyncCommand = serde_json::from_str(&body)?; println!("{:#?}", sync); Ok(()) @@ -88,7 +89,10 @@ async fn sync>(key: S) -> Result<(), Box> { #[tokio::main] async fn main() -> Result<(), Box> { - let key = std::env::args().skip(1).next().expect("Need a key as an argument"); + let key = std::env::args() + .skip(1) + .next() + .expect("Need a key as an argument"); let mut sigint = signal(SignalKind::interrupt())?; loop {