mirror of
https://github.com/actix/examples
synced 2025-06-28 09:50:36 +02:00
clippy
This commit is contained in:
@ -15,6 +15,7 @@ pub enum WeatherAgg {
|
||||
MonthAgg { year: i32, month: i32, total: f64 },
|
||||
}
|
||||
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
pub enum Queries {
|
||||
GetTopTenHottestYears,
|
||||
GetTopTenColdestYears,
|
||||
|
@ -40,10 +40,10 @@ async fn cache_stuff(
|
||||
.collect();
|
||||
|
||||
// successful operations return "OK", so confirm that all returned as so
|
||||
if !res.iter().all(|res| match res {
|
||||
Ok(RespValue::SimpleString(x)) if x == "OK" => true,
|
||||
_ => false,
|
||||
}) {
|
||||
if !res
|
||||
.iter()
|
||||
.all(|res| matches!(res,Ok(RespValue::SimpleString(x)) if x == "OK"))
|
||||
{
|
||||
Ok(HttpResponse::InternalServerError().finish())
|
||||
} else {
|
||||
Ok(HttpResponse::Ok().body("successfully cached values"))
|
||||
|
@ -5,7 +5,7 @@ lazy_static::lazy_static! {
|
||||
pub static ref SECRET_KEY: String = std::env::var("SECRET_KEY").unwrap_or_else(|_| "0123".repeat(8));
|
||||
}
|
||||
|
||||
const SALT: &'static [u8] = b"supersecuresalt";
|
||||
const SALT: &[u8] = b"supersecuresalt";
|
||||
|
||||
// WARNING THIS IS ONLY FOR DEMO PLEASE DO MORE RESEARCH FOR PRODUCTION USE
|
||||
pub fn hash_password(password: &str) -> Result<String, ServiceError> {
|
||||
@ -13,7 +13,7 @@ pub fn hash_password(password: &str) -> Result<String, ServiceError> {
|
||||
secret: SECRET_KEY.as_bytes(),
|
||||
..Default::default()
|
||||
};
|
||||
argon2::hash_encoded(password.as_bytes(), &SALT, &config).map_err(|err| {
|
||||
argon2::hash_encoded(password.as_bytes(), SALT, &config).map_err(|err| {
|
||||
dbg!(err);
|
||||
ServiceError::InternalServerError
|
||||
})
|
||||
|
Reference in New Issue
Block a user