Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe40249

Browse files
authored
chore(deps): support strum 0.28 (#224)
## Summary This PR fixes the `strum 0.28` dependency bump proposed in [#210](#210) and adds explicit `cargo check --all-targets --all-features --workspace` coverage so example-target compile failures are caught directly in CI instead of being missed by the existing workspace check. ## Root Cause The failure came from the `tui-bar-graph` example, where clap derives a parser for `BarStyle`. `BarStyle` still derives `FromStr`, and this was not caused by the `#[strum(default)]` behavior change from [strum PR #476](Peternator7/strum#476). The actual issue was dependency resolution plus feature unification. Before the bump, `tui-bar-graph` and `ratatui-core` both used `strum 0.27`, so Cargo unified them and `ratatui-core`'s `strum/std` activation effectively carried `std` into the `strum` instance used by `tui-bar-graph`. After [#210](#210), `tui-bar-graph` used `strum 0.28` while `ratatui-core` still used `strum 0.27`, so the graph split into separate `strum` packages. At that point, `tui-bar-graph`'s own `strum 0.28` was built with `default-features = false`, which meant `strum::ParseError` no longer implemented `std::error::Error` in that context. That was enough to break clap's inferred parser for `BarStyle`. ## Code Changes `tui-bar-graph` now declares an explicit `std` feature and uses it to enable `strum/std`. `std` remains enabled by default, so the crate's normal ergonomics do not change. The interactive example is marked with `required-features = ["std"]` so its compile requirements are explicit instead of depending on accidental transitive feature behavior. `colorgrad` now uses `default-features = false`. ## Why Only `strum/std` `strum/std` matters here because it affects trait-based downstream integration on a public enum type. `BarStyle` derives traits whose interaction with clap depends on the trait set of `strum::ParseError`. `colorgrad/std` does not play the same role in this crate today, so the `std` feature does not forward `colorgrad/std`. ## Docs The crate now uses `document-features` so the feature contract is rendered in generated docs and on docs.rs. ## CI The issue exposed by [#210](#210) was a normal compile failure in a non-lib target. The workspace already ran `cargo check --all-features --workspace`, but that does not compile examples and other non-lib targets. `cargo check --all-targets --all-features --workspace` reproduces the failure directly. This PR adds explicit all-targets compile coverage so example-target breakage is caught as a normal build/check failure. ## Verification ```shell cargo check --all-targets --all-features --workspace cargo clippy --all-targets --all-features --workspace -- -D warnings cargo check -p tui-bar-graph --lib --no-default-features cargo doc -p tui-bar-graph --all-features cargo rdme --check --manifest-path tui-bar-graph/Cargo.toml ``` ## Follow-up A broader `no_std` audit of the other widget crates was done during this work and recorded separately on [#102](#102).
1 parent 7596dd3 commit fe40249

5 files changed

Lines changed: 69 additions & 80 deletions

File tree

.github/workflows/check.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ jobs:
3838
- name: Run clippy
3939
run: cargo clippy --all-targets --all-features --workspace -- -D warnings
4040

41+
targets:
42+
name: Check Targets
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Checkout repository
46+
uses: actions/checkout@v6
47+
- name: Install Rust toolchain
48+
uses: dtolnay/rust-toolchain@stable
49+
- name: Cache Rust build artifacts
50+
uses: Swatinem/rust-cache@v2
51+
- name: Check all workspace targets
52+
run: cargo check --all-targets --all-features --workspace
53+
4154
docs:
4255
name: Docs
4356
runs-on: ubuntu-latest

Cargo.lock

Lines changed: 38 additions & 78 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ratatui-core = { version = "0.1" }
3131
ratatui-macros = "0.7"
3232
ratatui-widgets = { version = "0.3" }
3333
rstest = "0.26"
34-
strum = { version = "0.27", default-features = false, features = ["derive"] }
34+
strum = { version = "0.28", default-features = false, features = ["derive"] }
3535
tokio = { version = "1" }
3636

3737
[lints.rust]

tui-bar-graph/Cargo.toml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,18 @@ rust-version.workspace = true
1111
categories.workspace = true
1212
keywords.workspace = true
1313

14+
[package.metadata.docs.rs]
15+
all-features = true
16+
rustdoc-args = ["--cfg", "docsrs"]
17+
18+
[features]
19+
default = ["std"]
20+
## enables std
21+
std = ["strum/std"]
22+
1423
[dependencies]
15-
colorgrad = { version = "0.8", features = ["preset"] }
24+
colorgrad = { version = "0.8", default-features = false, features = ["preset"] }
25+
document-features.workspace = true
1626
ratatui-core.workspace = true
1727
strum.workspace = true
1828

@@ -22,3 +32,7 @@ color-eyre.workspace = true
2232
crossterm.workspace = true
2333
rand.workspace = true
2434
ratatui = { workspace = true, default-features = true }
35+
36+
[[example]]
37+
name = "tui-bar-graph"
38+
required-features = ["std"]

tui-bar-graph/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
//!
8282
//! [Joshka]: https://github.com/joshka
8383
//! [tui-widgets]: https://crates.io/crates/tui-widgets
84+
#![cfg_attr(docsrs, doc = "\n# Feature flags\n")]
85+
#![cfg_attr(docsrs, doc = document_features::document_features!())]
8486

8587
use colorgrad::Gradient;
8688
use ratatui_core::buffer::Buffer;

0 commit comments

Comments
 (0)