mirror of
https://github.com/actix/examples
synced 2025-02-17 07:23:29 +01:00
address clippy lints
This commit is contained in:
parent
66c7e1e9b5
commit
b91e424ab4
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -4644,6 +4644,7 @@ version = "1.0.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
"log",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
]
|
]
|
||||||
|
@ -5,10 +5,8 @@ use std::time::Duration;
|
|||||||
use apalis::{prelude::*, redis::RedisStorage};
|
use apalis::{prelude::*, redis::RedisStorage};
|
||||||
use rand::Rng as _;
|
use rand::Rng as _;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use tokio::task::JoinHandle;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
|
|
||||||
pub(crate) struct Email {
|
pub(crate) struct Email {
|
||||||
to: String,
|
to: String,
|
||||||
}
|
}
|
||||||
@ -51,11 +49,12 @@ pub(crate) async fn start_processing_email_queue() -> anyhow::Result<RedisStorag
|
|||||||
});
|
});
|
||||||
|
|
||||||
// spawn job monitor into background
|
// spawn job monitor into background
|
||||||
let _ = tokio::spawn(async move {
|
// the monitor manages itself otherwise so we don't need to return a join handle
|
||||||
|
#[allow(clippy::let_underscore_future)]
|
||||||
|
let _ = tokio::spawn(
|
||||||
// run_without_signals: don't listen for ctrl-c because Actix Web does
|
// run_without_signals: don't listen for ctrl-c because Actix Web does
|
||||||
// the monitor manages itself otherwise so we don't need to return a join handle
|
monitor.run_without_signals(),
|
||||||
monitor.run_without_signals().await;
|
);
|
||||||
});
|
|
||||||
|
|
||||||
Ok(storage)
|
Ok(storage)
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ pub(crate) async fn cache_item(
|
|||||||
// insert into item cache
|
// insert into item cache
|
||||||
cache.lock().unwrap().insert(form.data, expires);
|
cache.lock().unwrap().insert(form.data, expires);
|
||||||
|
|
||||||
Ok(HttpResponse::Ok().body(format!("data cached until {:?}", expires)))
|
Ok(HttpResponse::Ok().body(format!("data cached until {expires}")))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[post("/email")]
|
#[post("/email")]
|
||||||
|
@ -4,7 +4,8 @@ version = "1.0.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = { workspace = true, features = ["openssl"] }
|
actix-web.workspace = true
|
||||||
env_logger.workspace = true
|
env_logger.workspace = true
|
||||||
serde = { version = "^1.0", features = ["derive"] }
|
log.workspace = true
|
||||||
serde_json = "1.0.39"
|
serde = { version = "1", features = ["derive"] }
|
||||||
|
serde_json = "1"
|
||||||
|
@ -3,8 +3,9 @@ use nested_routing::app_config::config_app;
|
|||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
std::env::set_var("RUST_LOG", "actix_server=info,actix_web=info");
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
env_logger::init();
|
|
||||||
|
log::info!("starting HTTP server at http://localhost:8080");
|
||||||
|
|
||||||
HttpServer::new(|| {
|
HttpServer::new(|| {
|
||||||
App::new()
|
App::new()
|
Loading…
x
Reference in New Issue
Block a user