From beb80cc183935b28a9d9e0b78951f970ea4b0d68 Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 3 Jan 2024 23:35:12 +0100 Subject: [PATCH] fix: solve warnings when not all features --- src/routes.rs | 4 +++- src/storage.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/routes.rs b/src/routes.rs index 80723f5..4fe2f0a 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -1,10 +1,11 @@ use std::sync::Arc; -use axum::{Json, Form, Router, routing::{put, post, get}, extract::{State, Query}, response::{Redirect, Html}}; +use axum::{Json, Form, Router, routing::{put, post, get}, extract::{State, Query}, response::Redirect}; use crate::{notifications::NotificationProcessor, model::{Page, PageOptions, PageInsertion, PageView}, storage::StorageProvider, config::ConfigRouting}; pub fn create_router_with_app_routes(state: Context) -> Router { + #[allow(unused_mut)] let mut router = Router::new() .route("/api", get(get_suggestion)) .route("/api", post(send_suggestion_form)) @@ -14,6 +15,7 @@ pub fn create_router_with_app_routes(state: Context) -> Router { { use sailfish::TemplateOnce; use axum_extra::response::{Css, JavaScript}; + use axum::response::Html; let template = crate::web::IndexTemplate::from(&state.template) .render_once() diff --git a/src/storage.rs b/src/storage.rs index d4d07ec..92f14ed 100644 --- a/src/storage.rs +++ b/src/storage.rs @@ -27,6 +27,7 @@ pub struct StorageProvider { // https://github.com/launchbadge/sqlx/issues/2778 // so the `public` field is an integer which is ridicolous +#[cfg(any(feature = "sqlite", feature = "mysql"))] const SQLITE_SCHEMA : &str = " CREATE TABLE IF NOT EXISTS pages ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -36,8 +37,9 @@ CREATE TABLE IF NOT EXISTS pages ( timestamp INTEGER NOT NULL, public INTEGER NOT NULL ); -"; +"; // TODO make schema specific for mysql +#[cfg(feature = "postgres")] const POSTGRES_SCHEMA : &str = " CREATE TABLE IF NOT EXISTS pages ( id SERIAL PRIMARY KEY,