Fix remaining clippy/formatting warnings
- Merge unnecessary line splits in db/pool.rs and pages/admin.rs - Prefix unused variable with underscore in login.rs Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0b15cc7e1c
commit
cbf19b3f47
@ -4,8 +4,7 @@ use deadpool_postgres::{Manager, ManagerConfig, Pool, RecyclingMethod};
|
|||||||
use tokio_postgres::NoTls;
|
use tokio_postgres::NoTls;
|
||||||
|
|
||||||
pub static DB_POOL: LazyLock<Pool> = LazyLock::new(|| {
|
pub static DB_POOL: LazyLock<Pool> = LazyLock::new(|| {
|
||||||
let db_url =
|
let db_url = std::env::var("DATABASE_URL").expect("DATABASE_URL environment variable not set");
|
||||||
std::env::var("DATABASE_URL").expect("DATABASE_URL environment variable not set");
|
|
||||||
let pg_cfg = db_url
|
let pg_cfg = db_url
|
||||||
.parse::<tokio_postgres::Config>()
|
.parse::<tokio_postgres::Config>()
|
||||||
.expect("Invalid DATABASE_URL format");
|
.expect("Invalid DATABASE_URL format");
|
||||||
|
|||||||
@ -7,9 +7,8 @@ use crate::api::auth::{get_current_user, logout};
|
|||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn AdminPage() -> Element {
|
pub fn AdminPage() -> Element {
|
||||||
let user_resource = use_resource(|| async move {
|
let user_resource =
|
||||||
get_current_user().await.ok().and_then(|r| r.user)
|
use_resource(|| async move { get_current_user().await.ok().and_then(|r| r.user) });
|
||||||
});
|
|
||||||
|
|
||||||
let navigator = dioxus::router::navigator();
|
let navigator = dioxus::router::navigator();
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ pub fn LoginPage() -> Element {
|
|||||||
|
|
||||||
spawn(async move {
|
spawn(async move {
|
||||||
match login(username_val, password_val).await {
|
match login(username_val, password_val).await {
|
||||||
Ok(AuthResponse { success: true, token: Some(token), .. }) => {
|
Ok(AuthResponse { success: true, token: Some(_token), .. }) => {
|
||||||
// 设置 cookie (client-side, not HttpOnly but works for now)
|
// 设置 cookie (client-side, not HttpOnly but works for now)
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user