Git Product home page Git Product logo

Comments (3)

tormol avatar tormol commented on June 12, 2024

serde is an optional dependency, so how does one add a feature-specific dev-dependency?

I tried

[target.'cfg(feature="serde")'.dev-dependencies]
serde_test = "1.0"

but cargo warns that it doesn't work as expected, and extern crate serde_test; fails. (With and without resolver = "2").

Is it the norm to require all features to build tests?

(I've also asked about this in an r/rust questions thread, but since this isn't the only project with optional serde support you've opened an issue for, I guess you know.)

from rust-ascii.

tormol avatar tormol commented on June 12, 2024

Based on your comment on circular-queue I tried just doing

[dev-dependencies]
serde_test = "1.0"

but when I run cargo build --no-default-features --tests I get

   Compiling serde v1.0.163
   Compiling serde_test v1.0.163
   Compiling ascii v1.1.0 (/home/tbm/p/rust/libs/ascii)
    Finished dev [unoptimized + debuginfo] target(s) in 1.93s

even though serde was not enabled.
so what you said about the serde_test dependency not being compiled appears not to be the case.

from rust-ascii.

Mingun avatar Mingun commented on June 12, 2024

Hm, I tried to provide compilation of quick-xml which have only one required dependency, but cargo test --no-default-features builds all libraries listed in [dev-dependencies] section, even unused for the selected test options (for example, tokio-test which needed only when enabling async-tokio feature). So it seems that my assumption is wrong and I observed some other effect that reduced number of used libraries.

from rust-ascii.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.