Skip to content

Commit 19d9ddc

Browse files
Make file format features non-default
It seems that most users only use a single file format and many forget to disable default-features, leading to a uselessly inflated dependency tree. This way around makes the library a tiny bit harder to get started with, but I am willing to sacrifice this in order to save the world some compile time.
1 parent 04cf132 commit 19d9ddc

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

.github/workflows/ci.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
uses: Swatinem/rust-cache@v2
2727
- name: Build
2828
run: cargo build
29+
- name: Run tests with file formats
30+
run: cargo test --features=toml,yaml,json5
2931
- name: Run tests
30-
run: |
31-
cargo test
32-
cargo test --no-default-features
32+
run: cargo test

Cargo.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ required-features = ["toml"]
3434

3535

3636
[features]
37-
default = ["toml", "yaml", "json5"]
37+
default = []
3838
yaml = ["serde_yaml"]
3939

4040

@@ -47,3 +47,7 @@ toml = { version = "0.8", optional = true }
4747

4848
[dev-dependencies]
4949
pretty_assertions = "1.2.1"
50+
51+
52+
[package.metadata.docs.rs]
53+
all-features = true

src/lib.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
//!
99
//! # How to use
1010
//!
11+
//! Add `confique` as dependency to your `Cargo.toml` and remember to enable the
12+
//! crate features for file formats you are interested in. For example:
13+
//! `cargo add confique --features=toml`.
14+
//!
1115
//! ## Defining your configuration with structs
1216
//!
1317
//! First, define some structs that describe all your configuration values. Use
@@ -154,12 +158,12 @@
154158
//!
155159
//! # Cargo features
156160
//!
157-
//! This crate has a Cargo feature for each supported file format which are all
158-
//! enabled by default to get started easily. If you don't need certain
159-
//! features, remember to disable them to save compile time:
161+
//! This crate has a Cargo feature for each supported file format. These are not
162+
//! enabled by default, so you have to specify which file formats you are
163+
//! interested in.
160164
//!
161165
//! ```toml
162-
//! confique = { version = "...", default-features = false, features = ["toml"] }
166+
//! confique = { version = "...", features = ["toml"] }
163167
//! ```
164168
//!
165169
//! All crate features:

0 commit comments

Comments
 (0)