Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature gate serde usage #145

Closed
wants to merge 1 commit into from
Closed

feature gate serde usage #145

wants to merge 1 commit into from

Conversation

nicbus
Copy link
Contributor

@nicbus nicbus commented Mar 12, 2024

This PR feature gates serde functionality, fixing clippy and build errors.

While linting the project I ran into these errors reported by clippy --no-default-features.
Interestingly, the errors are not reported if clippy is run with the --workspace option, which is what is used in GH Actions Lints workflow.

I have confirmed the errors are correct trying to build rgb-lib depending on rgb-runtime with the serde feature disabled. This way I get the exact same errors clippy reports without --workspace. I have also checked that it compiles and runs all tests fine when including this PR.

I think the issue with specifying --workspace is that dependency resolution is different. Specifically, rgb-wallet's dependency on rgb-runtime with all enabled features, including serde, might be masking the errors by inadvertently enabling the serde feature on rgb-runtime even if --no-default-features is used.

I am quite confident this might be the case as clippy correctly reports the errors if either cli is removed from the workspace members or the serde feature is removed from rgb-wallet's dependency on rgb-runtime.

I guess the usage of the --workspace option might also be the reason why some GH Actions jobs, like Build > no-default, pass instead of failing (cargo check --no-default-features fails without --workspace on master and passes with this PR).

I think cargo commands need to be run without --workspace, possibly separately for each package, in order to avoid hiding errors.

@dr-orlovsky
Copy link
Member

cfg_eval is a PITA: I tried to use it here before - and it was a mess everywhere, so I got rid of it. I will check whether there any other way of fixing the lint and the way dependencies are computed...

@dr-orlovsky dr-orlovsky added help wanted Extra attention is needed question Further information is requested labels Mar 17, 2024
@dr-orlovsky dr-orlovsky added this to the v0.11.0 milestone Mar 17, 2024
@dr-orlovsky dr-orlovsky self-requested a review March 18, 2024 08:45
@dr-orlovsky
Copy link
Member

Maybe I am missing something, but I was able to fix the issue with no cfg_eval, which was unexpected for me. Seems everything works: f9813b7#diff-f643199b78cd917deee88c751028d85bc710961b6f7b874f3c99cf6935fd68b0L109-L118

@dr-orlovsky
Copy link
Member

Closing this in favor of fix in ac43eb2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants