Skip to content

Commit

Permalink
Check for bad command-line configuration (#581)
Browse files Browse the repository at this point in the history
  • Loading branch information
ia0 authored Aug 9, 2024
1 parent db23f35 commit d5cf0fb
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 2 deletions.
5 changes: 5 additions & 0 deletions crates/api-desc/crates/update/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ struct Flags {
lang: Lang,
}

#[test]
fn flags() {
<Flags as clap::CommandFactory>::command().debug_assert();
}

#[derive(Copy, Clone, ValueEnum)]
pub enum Lang {
C,
Expand Down
2 changes: 1 addition & 1 deletion crates/api-desc/crates/update/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ set -e

test_helper

cargo check --bin=update
cargo test --bin=update
1 change: 1 addition & 0 deletions crates/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Patch

- Check for bad command-line configuration
- Update dependencies
- Restore release builds to the default

Expand Down
5 changes: 5 additions & 0 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ struct Flags {
action: Action,
}

#[test]
fn flags() {
<Flags as clap::CommandFactory>::command().debug_assert();
}

#[derive(clap::Subcommand)]
enum Action {
/// Lists the applets installed on a platform.
Expand Down
5 changes: 5 additions & 0 deletions crates/runner-host/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ struct Flags {
web_options: WebOptions,
}

#[test]
fn flags() {
<Flags as clap::CommandFactory>::command().debug_assert();
}

#[derive(clap::Args)]
struct WebOptions {
/// Host to start the webserver.
Expand Down
5 changes: 5 additions & 0 deletions crates/xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ struct Flags {
command: MainCommand,
}

#[test]
fn flags() {
<Flags as clap::CommandFactory>::command().debug_assert();
}

#[derive(clap::Args)]
struct MainOptions {
/// Compiles without debugging support.
Expand Down
2 changes: 1 addition & 1 deletion scripts/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ for dir in $(find crates -name Cargo.toml -printf '%h\n' | sort); do
add_lint $file allow clippy.unit-arg
# add_lint $file warn rust.elided-lifetimes-in-paths
# add_lint $file warn rust.missing-debug-implementations
# TODO: Use the same [ -e src/lib.rs -a "$(package_publish)" = true ] test is test-helper.
# TODO: Use the same [ -e src/lib.rs -a "$(package_publish)" = true ] test as in test-helper.
case $crate in
board|prelude) add_lint $file warn rust.missing-docs ;;
esac
Expand Down

0 comments on commit d5cf0fb

Please sign in to comment.