chore: add linting & formatting
This commit is contained in:
parent
28da5dca70
commit
c8fc98f3e5
4 changed files with 20 additions and 7 deletions
2
.clippy.toml
Normal file
2
.clippy.toml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# .clippy.toml
|
||||||
|
allow-unwrap-in-tests = true
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1 +1,5 @@
|
||||||
/target
|
/target
|
||||||
|
|
||||||
|
*~
|
||||||
|
*swo
|
||||||
|
*swp
|
||||||
|
|
10
.rustfmt.toml
Normal file
10
.rustfmt.toml
Normal file
|
@ -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
|
11
src/main.rs
11
src/main.rs
|
@ -1,5 +1,5 @@
|
||||||
// src/main.rs
|
// src/main.rs
|
||||||
use actix_web::{App, HttpResponse, HttpServer, Responder, web};
|
use actix_web::{App, HttpServer, Responder, web};
|
||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
|
@ -12,12 +12,9 @@ async fn main() -> std::io::Result<()> {
|
||||||
|
|
||||||
async fn index() -> impl Responder {
|
async fn index() -> impl Responder {
|
||||||
// Make GET request to the external API
|
// Make GET request to the external API
|
||||||
let response = reqwest::get(
|
let response = reqwest::get("https://fosstodon.org/api/v1/trends/statuses")
|
||||||
"https://fosstodon.org/api/v1/trends/statuses
|
.await
|
||||||
",
|
.unwrap();
|
||||||
)
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
// Get the response json
|
// Get the response json
|
||||||
let json_response: serde_json::Value = response.json().await.unwrap();
|
let json_response: serde_json::Value = response.json().await.unwrap();
|
||||||
|
|
Loading…
Reference in a new issue