rinja-rs / rinja

A template rendering engine based on Jinja, generating type-safe Rust code at compile time.
https://rinja.readthedocs.io
Apache License 2.0
116 stars 10 forks source link

Fix cfg using non-existing feature #5

Closed GuillaumeGomez closed 3 months ago

GuillaumeGomez commented 3 months ago

Fixes this warning:

warning: unexpected `cfg` condition value: `toml`
   --> rinja_derive/src/config.rs:576:11
    |
576 |     #[cfg(feature = "toml")]
    |           ^^^^^^^^^^^^^^^^
    |
    = note: expected values for `feature` are: `basic-toml`, `config`, `humansize`, `num-traits`, `serde`, `serde-json`, `urlencode`, `with-actix-web`, `with-axum`, `with-rocket`, and `with-warp`
    = help: consider adding `toml` as a feature in `Cargo.toml`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

It's been a while that this was the case though. Seems like these tests were basically never run?

Kijewski commented 3 months ago

I think we should update the features to suppress implicit features like some_crate, and use dep:some_crate instead. Then it will be clearer what the actual feature names are.

GuillaumeGomez commented 3 months ago

Good idea!

GuillaumeGomez commented 3 months ago

Fixed it.

GuillaumeGomez commented 3 months ago

And fixed clippy too. :)

Kijewski commented 3 months ago

I love clippy. :) Those kind of bugs and shortcomings are impossible to find unless to read the whole code base repeatedly.

GuillaumeGomez commented 3 months ago

It's not clippy but rustc in this case. But yes, it's really awesome!