From ac901ccf4a3f9b738ece05d2b99f726970db2243 Mon Sep 17 00:00:00 2001 From: murmeldin Date: Thu, 12 Dec 2024 15:29:16 +0100 Subject: [PATCH] cargo fmt --- src/main.rs | 3 ++- src/matrix.rs | 11 ++++++++--- src/mediawiki.rs | 9 +++++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 25b8408..52e4cf7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -471,7 +471,8 @@ fn do_protocol( wiki: &Mediawiki, ) -> Result<(), Box> { NYI!("trace/verbose annotations"); - let (current_pad_id, pad_content_without_cleanup, toc, n_topics) = get_pad_info(config, hedgedoc); + let (current_pad_id, pad_content_without_cleanup, toc, n_topics) = + get_pad_info(config, hedgedoc); if !toc.is_empty() { let human_date = plenum_day.format("%d.%m.%Y"); let pad_content = hedgedoc::strip_metadata(pad_content_without_cleanup.clone()); diff --git a/src/matrix.rs b/src/matrix.rs index 688a783..8a025ab 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -84,7 +84,8 @@ impl std::fmt::Debug for MatrixClient { impl MatrixClient { pub fn new( - homeserver_url: &str, user_id: &str, access_token: &str, room_id_for_short_messages: &str, room_id_for_long_messages: &str, is_dry_run: bool, + homeserver_url: &str, user_id: &str, access_token: &str, room_id_for_short_messages: &str, + room_id_for_long_messages: &str, is_dry_run: bool, ) -> Self { Self { homeserver_url: homeserver_url.to_string(), @@ -175,7 +176,9 @@ impl MatrixClient { current } - pub fn send_room_message(&mut self, room_id: &str, text: &str) -> Result> { + pub fn send_room_message( + &mut self, room_id: &str, text: &str, + ) -> Result> { let content = HashMap::from([("msgtype", "m.text"), ("body", text)]); self.send_room_event(&room_id, "m.room.message", &content) } @@ -186,7 +189,9 @@ impl MatrixClient { let endpoint = format!("/r0/rooms/{}/send/{}/{}", room, event_type, self.txn_id()); self.put(&endpoint, None, Some(content), false) } - pub fn send_short_and_long_messages_to_two_rooms(&mut self, short_message: &str, long_message: &str) -> Result<(), Box> { + pub fn send_short_and_long_messages_to_two_rooms( + &mut self, short_message: &str, long_message: &str, + ) -> Result<(), Box> { self.send_room_message(&long_message, &self.room_id_for_long_messages.clone())?; self.send_room_message(&short_message, &self.room_id_for_short_messages.clone())?; Ok(()) diff --git a/src/mediawiki.rs b/src/mediawiki.rs index 416333d..6305d43 100644 --- a/src/mediawiki.rs +++ b/src/mediawiki.rs @@ -301,9 +301,14 @@ impl Mediawiki { if let Some(error) = response.get("error") { if let Some(info) = error.get("info") { if info == "The page you tried to create has been created already." { - verboseln!("The page you tried to create has been created already. Continuing...") + verboseln!( + "The page you tried to create has been created already. Continuing..." + ) } else { - println!("There was an error while editing the wiki: {}", info.to_string().yellow()) + println!( + "There was an error while editing the wiki: {}", + info.to_string().yellow() + ) } } } else if let Some(edit) = response.get("edit") {