chore: clippy suggestions

This commit is contained in:
Per Stark
2025-03-31 12:35:46 +02:00
parent b2759bfa73
commit 524ee5f0e1
8 changed files with 32 additions and 28 deletions

View File

@@ -94,7 +94,7 @@ impl TemplateResponse {
pub fn redirect(path: impl Into<String>) -> Self {
Self {
template_kind: TemplateKind::Redirect(path.into()),
context: Value::from_serialize(&()),
context: Value::from_serialize(()),
}
}
}

View File

@@ -38,13 +38,15 @@ macro_rules! create_asset_service {
}};
}
pub type MiddleWareVecType<S> = Vec<Box<dyn FnOnce(Router<S>) -> Router<S> + Send>>;
pub struct RouterFactory<S> {
app_state: HtmlState,
public_routers: Vec<Router<S>>,
protected_routers: Vec<Router<S>>,
nested_routes: Vec<(String, Router<S>)>,
nested_protected_routes: Vec<(String, Router<S>)>,
custom_middleware: Vec<Box<dyn FnOnce(Router<S>) -> Router<S> + Send>>,
custom_middleware: MiddleWareVecType<S>,
public_assets_config: Option<AssetsConfig>,
}

View File

@@ -112,7 +112,7 @@ pub async fn show_change_password(
) -> Result<impl IntoResponse, HtmlError> {
Ok(TemplateResponse::new_template(
"auth/change_password_form.html",
{},
(),
))
}
@@ -138,6 +138,6 @@ pub async fn change_password(
Ok(TemplateResponse::new_partial(
"auth/account_settings.html",
"change_password_section",
{},
(),
))
}

View File

@@ -31,9 +31,9 @@ pub async fn show_signin_form(
true => Ok(TemplateResponse::new_partial(
"auth/signin_form.html",
"body",
{},
(),
)),
false => Ok(TemplateResponse::new_template("auth/signin_form.html", {})),
false => Ok(TemplateResponse::new_template("auth/signin_form.html", ())),
}
}

View File

@@ -33,9 +33,9 @@ pub async fn show_signup_form(
true => Ok(TemplateResponse::new_partial(
"auth/signup_form.html",
"body",
{},
(),
)),
false => Ok(TemplateResponse::new_template("auth/signup_form.html", {})),
false => Ok(TemplateResponse::new_template("auth/signup_form.html", ())),
}
}

View File

@@ -92,7 +92,7 @@ pub async fn process_ingress_form(
input
.files
.into_iter()
.map(|file| FileInfo::new(file, &state.db, &user.id).map_err(|e| AppError::from(e))),
.map(|file| FileInfo::new(file, &state.db, &user.id).map_err(AppError::from)),
)
.await?;

View File

@@ -85,7 +85,7 @@ pub async fn show_knowledge_page(
let edge_trace = Scatter3D::new(edge_x, edge_y, edge_z)
.mode(Mode::Lines)
.line(Line::new().color("#888").width(2.0))
.hover_template(&format!(
.hover_template(format!(
"Relationship: {}<br>",
rel.metadata.relationship_type
))