From c8fc98f3e5272246600a5285776d86918f42a3a6 Mon Sep 17 00:00:00 2001 From: Ayo Date: Tue, 26 Aug 2025 21:14:29 +0200 Subject: [PATCH] chore: add linting & formatting --- .clippy.toml | 2 ++ .gitignore | 4 ++++ .rustfmt.toml | 10 ++++++++++ src/main.rs | 11 ++++------- 4 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 .clippy.toml create mode 100644 .rustfmt.toml diff --git a/.clippy.toml b/.clippy.toml new file mode 100644 index 0000000..2a7ae3d --- /dev/null +++ b/.clippy.toml @@ -0,0 +1,2 @@ +# .clippy.toml +allow-unwrap-in-tests = true diff --git a/.gitignore b/.gitignore index ea8c4bf..a42318f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ /target + +*~ +*swo +*swp diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..723a31e --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,10 @@ +# .rustfmt.toml +max_width = 100 +hard_tabs = false +tab_spaces = 4 +newline_style = "Auto" +use_small_heuristics = "Default" +indent_style = "Block" +wrap_comments = true +format_code_in_doc_comments = true +doc_comment_code_block_width = 100 diff --git a/src/main.rs b/src/main.rs index ed450e6..9957fd9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ // src/main.rs -use actix_web::{App, HttpResponse, HttpServer, Responder, web}; +use actix_web::{App, HttpServer, Responder, web}; #[actix_web::main] async fn main() -> std::io::Result<()> { @@ -12,12 +12,9 @@ async fn main() -> std::io::Result<()> { async fn index() -> impl Responder { // Make GET request to the external API - let response = reqwest::get( - "https://fosstodon.org/api/v1/trends/statuses -", - ) - .await - .unwrap(); + let response = reqwest::get("https://fosstodon.org/api/v1/trends/statuses") + .await + .unwrap(); // Get the response json let json_response: serde_json::Value = response.json().await.unwrap();