njord-rs / njord

A lightweight ORM library for Rust ⛵
https://njord.rs
BSD 3-Clause "New" or "Revised" License
398 stars 21 forks source link

Feature flag doesn't conditionally enable code #164

Closed mjovanc closed 6 days ago

mjovanc commented 1 week ago

When trying to use the njord dependency using git repo link as well as feature flag on latest it doesn't activate the specific code.

For example adding this:

njord = { git = "https://github.com/njord-rs/njord", package = "njord", branch = "master", features = ["sqlite"] }

It should active this code inside njord/src/lib.rs:

#[cfg(feature = "sqlite")]
pub mod sqlite;

But it doesn't, the Rust analyzer says:

Conditionally disabled code

Angr1st commented 1 week ago

I just copied your sqllite example and replaced the njord dependency with your example and it worked fine after also fixing the relative db file path. Maybe it is only a rust analyser issue.

mjovanc commented 1 week ago

@Angr1st Thanks for checking this. It might actually be. I'm using IntelliJ with the Rust plugin. We are soon ready for release and if this is not working, that is not good. I will try in VS Code with Rust Analyzer as well to confirm.

Angr1st commented 1 week ago

How exactly are you surfacing this error? Im using helix and when I do go to definition of the njord::sqllite it puts me into the sqllite::mod.rs file. If I dont active the sqllite feature I get build errors regarding the missing sqllite module.

chaseWillden commented 6 days ago

Hmm, I can't reproduce this issue either, it seems to work fine for me

mjovanc commented 6 days ago

Attaching some screenshots just to show. I have done cargo clean, invalidate all caches etc. It seems to be an issue with the Rust plugin and/or IntelliJ. Maybe @bravit can take a look? I have no idea if this is still supported. Closing this for now since you can't reproduce it.

Screenshot 2024-10-20 at 10 18 29 AM Screenshot 2024-10-20 at 10 18 39 AM Screenshot 2024-10-20 at 10 18 49 AM