Altair-Bueno / axum-template

Layers, extractors and template engine wrappers for axum based Web MVC applications
https://crates.io/crates/axum-template
MIT License
78 stars 6 forks source link

Consider marking `RenderHtml` #[must_use] #32

Closed TheNeikos closed 1 year ago

TheNeikos commented 1 year ago

I've ran into this situation:

async fn handler(
    engine: impl TemplateEngine,
) -> impl IntoResponse {
    let key = "Template key";
    let data = Person{ /* */ };
    RenderHtml(key, engine, data);
}

This renders nothing on the output and also produces no warnings!

Since RenderHtml is not marked #[must_use] the compiler happily ignored it and used the default return value of () as my IntoResponse implementation.

Having #[must_use] here would at least tell me something is up, and fix the error. (Since ; is also fairly small and easy to miss)

Altair-Bueno commented 1 year ago

Thats unfortunate. It was an oversight from me. It will be fixed on 1.0.0.

Altair-Bueno commented 1 year ago