From: Simon Tatham Date: Sat, 3 Feb 2024 11:35:28 +0000 (+0000) Subject: Tidy up a few rustfmt divergences. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=4b7a7f98811c1413704cf65ba3d1c71400c40551;p=mastodonochrome.git Tidy up a few rustfmt divergences. One of them misaligns Ian's list of test cases (sorry), but it does have the advantage that I can M-x rust-format-buffer any time I've made a mess, and not have to think too hard about tidying it up. --- diff --git a/src/client.rs b/src/client.rs index e15328f..8de75dc 100644 --- a/src/client.rs +++ b/src/client.rs @@ -715,7 +715,7 @@ impl Client { Ok(y) => y, Err(e) => { return ClientError::InvalidJSONSyntax(url, e.to_string()) - }, + } }; let val_restring = serde_json::to_string(&val) .unwrap_or_else(|e| format!("failed to regenerate json! {e}")); @@ -846,7 +846,7 @@ impl Client { &mut self, id: &str, ) -> Result { - let req = Req::get("api/v1/accounts/relationships").param("id", id); + let req = Req::get("api/v1/accounts/relationships").param("id", id); let (rels, url) = self.api_request_parse::>(req)?; for rel in rels { if rel.id == id { diff --git a/src/editor.rs b/src/editor.rs index 748f789..2d6a28e 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -992,9 +992,10 @@ pub fn get_user_to_examine() -> Box { reqwest::StatusCode::NOT_FOUND, _, )) => LogicalAction::Goto( - OverlayActivity::BottomLineError( - format!("User '{}' not found", s) - ) + OverlayActivity::BottomLineError(format!( + "User '{}' not found", + s + )) .into(), ), @@ -1023,9 +1024,10 @@ pub fn get_post_id_to_read() -> Box { reqwest::StatusCode::NOT_FOUND, _, )) => LogicalAction::Goto( - OverlayActivity::BottomLineError( - format!("Post id {} not found", s) - ) + OverlayActivity::BottomLineError(format!( + "Post id {} not found", + s + )) .into(), ), diff --git a/src/main.rs b/src/main.rs index f45a62b..3ad7311 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,8 +20,8 @@ pub mod tui; pub mod types; use crate::config::ConfigLocation; -use crate::tui::Tui; use crate::top_level_error::TopLevelError; +use crate::tui::Tui; #[derive(Parser, Debug)] struct Args { diff --git a/src/types.rs b/src/types.rs index d11e5b7..980dd87 100644 --- a/src/types.rs +++ b/src/types.rs @@ -70,8 +70,8 @@ fn test_supposedly_non_negative() { serde_json::from_str::(j).unwrap_err(); }; - chk(r#"{ "a": 0 }"#, 0, "0"); - chk(r#"{ "a": 1 }"#, 1, "1"); + chk(r#"{ "a": 0 }"#, 0, "0"); + chk(r#"{ "a": 1 }"#, 1, "1"); chk(r#"{ "a": -1 }"#, -1, "unavailable"); chk_err(r#"{}"#); chk_err(r#"{ "a": -42 }"#);