mirror of
https://github.com/RGBCube/Site
synced 2025-07-31 13:07:46 +00:00
Apply clippy suggestions
This commit is contained in:
parent
5282e33e54
commit
27f8efb21b
3 changed files with 6 additions and 6 deletions
|
@ -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 {
|
||||
|
|
|
@ -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"),
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue