1
Fork 0
mirror of https://github.com/RGBCube/Site synced 2025-07-31 13:07:46 +00:00

Apply clippy suggestions

This commit is contained in:
RGBCube 2023-12-31 13:59:23 +03:00
parent 5282e33e54
commit 27f8efb21b
No known key found for this signature in database
3 changed files with 6 additions and 6 deletions

View file

@ -8,7 +8,7 @@ use maud::{
use crate::minify;
pub fn extension_of(path: &str) -> Option<&str> {
path.rsplit_once(".").map(|(_base, extension)| extension)
path.rsplit_once('.').map(|(_base, extension)| extension)
}
pub enum Js {

View file

@ -22,7 +22,7 @@ pub fn is_minifiable(path: &str) -> bool {
}
pub fn insert_min(path: &str) -> String {
match path.rsplit_once(".") {
match path.rsplit_once('.') {
Some((base, extension)) => format!("{base}.min.{extension}"),
None => format!("{path}.min"),
}

View file

@ -31,17 +31,17 @@ static ASSETS: LazyLock<HashMap<String, Bytes>> = LazyLock::new(|| {
let path = entry.path_bytes();
let path = String::from_utf8(path.to_vec()).unwrap();
if path.ends_with("/") || !ASSET_EXTENSIONS.iter().any(|ext| path.ends_with(ext)) {
if path.ends_with('/') || !ASSET_EXTENSIONS.iter().any(|ext| path.ends_with(ext)) {
continue;
}
let path = path.rsplit_once("/").unwrap_or(("", &path)).1;
let path = path.rsplit_once('/').unwrap_or(("", &path)).1;
let mut content = Vec::new();
entry.read_to_end(&mut content).unwrap();
if minify::is_minifiable(&path) {
let content = minify::generic(&path, &content);
if minify::is_minifiable(path) {
let content = minify::generic(path, &content);
log::info!("Minifying asset {path}");
assets.insert(minify::insert_min(path), Bytes::from(content));