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

Unable to Active v4 Feature for Example #522

Closed
ca-mantis-shrimp opened this issue Jul 28, 2021 · 2 comments
Closed

Unable to Active v4 Feature for Example #522

ca-mantis-shrimp opened this issue Jul 28, 2021 · 2 comments

Comments

@ca-mantis-shrimp
Copy link

Describe the bug
Im just trying to write some learning tests and i'm having trouble enabling the "v4" feature for this crate.

To Reproduce
main.rs

use uuid::Uuid;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    #[cfg(feature = "v4")] {
        let my_uuid = Uuid::new_v4()?;
        println!("{}", my_uuid);
    }
    Ok(())
}

Cargo.toml

[dependencies]

[dependencies.uuid]
version = "0.8"
features = ["serde", "v4"]

I've tried every permutation of the dependency setup but I can't get this example build to run! it runs successfully, but just doesn't do anything
Expected behavior
the example of building a v4 UUID and Printing it runs
Screenshots
If applicable, add screenshots to help explain your problem.
main with LSP diagnostics
run example

Additional context
Windows on WSL if that matters, but i don't think it should?

@ca-mantis-shrimp
Copy link
Author

I made it work after I removed the ? and the cfg directive. don't know why the cfg directive broke it since it was only supposed to check but I got it working now after seeing #521

@Dylan-DPC-zz
Copy link
Member

if you were writing this test in a separate project you don't need to feature gate it since the feature will always be enabled as you have mentioned it in Cargo.toml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants