fix unused warnings when building without default features

This commit is contained in:
zyl 2024-11-07 17:18:02 -08:00
parent f53cd56c39
commit f4a2708794
Signed by: zyl
SSH key fingerprint: SHA256:uxxbSXbdroP/OnKBGnEDk5q7EKB2razvstC/KmzdXXs
3 changed files with 13 additions and 14 deletions

View file

@ -65,7 +65,7 @@ impl SiteBuilder {
let mut tera = Tera::new(
site.site_path
.join("templates/**/*.tera")
.join(format!("{}/**/*.tera", crate::TEMPLATES_PATH))
.to_str()
.expect("failed to convert path to string"),
)

View file

@ -19,10 +19,19 @@ use warp::{
};
use crate::{
resource::RESOURCES_PATH, util::get_name, Site, SiteBuilder, PAGES_PATH, ROOT_PATH, SASS_PATH,
TEMPLATES_PATH,
resource::RESOURCES_PATH, Site, SiteBuilder, PAGES_PATH, ROOT_PATH, SASS_PATH, TEMPLATES_PATH,
};
/// Helper to get the "name" of a path.
fn get_name(path: &Path) -> (PathBuf, String) {
let name = path.with_extension("");
let name_str = name
.display()
.to_string()
.replace(std::path::MAIN_SEPARATOR, "/");
(name, name_str)
}
fn with_build_path(
build_path: PathBuf,
) -> impl Filter<Extract = (PathBuf,), Error = std::convert::Infallible> + Clone {

View file

@ -1,6 +1,6 @@
//! Module containing various utilities.
use std::path::{Path, PathBuf};
use std::path::Path;
/// Simple helper to remove the contents of a directory without removing the directory itself.
pub fn remove_dir_contents(path: &Path) -> eyre::Result<()> {
@ -16,13 +16,3 @@ pub fn remove_dir_contents(path: &Path) -> eyre::Result<()> {
Ok(())
}
/// Helper to get the "name" of a path.
pub fn get_name(path: &Path) -> (PathBuf, String) {
let name = path.with_extension("");
let name_str = name
.display()
.to_string()
.replace(std::path::MAIN_SEPARATOR, "/");
(name, name_str)
}