Skip to content

Commit 3065855

Browse files
fadeevaberickt
authored andcommitted
fix: the "unused warning" and doc tests
1 parent 53786e9 commit 3065855

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

argh/examples/goup.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use argh::FromArgs;
22

3-
#[derive(FromArgs, Debug)]
3+
#[derive(FromArgs, PartialEq, Debug)]
44
#[argh(
55
description = "{command_name} is a tool to reach new heights.\n\n\
66
Start exploring new heights:\n\n\
@@ -11,7 +11,7 @@ use argh::FromArgs;
1111
{command_name} --height 5 j\n\
1212
{command_name} --height 5 --pilot-nickname Wes jump"
1313
)]
14-
pub struct CliArgs {
14+
struct CliArgs {
1515
/// how high to go
1616
#[argh(option)]
1717
height: usize,
@@ -20,19 +20,19 @@ pub struct CliArgs {
2020
pilot_nickname: Option<String>,
2121
/// command to execute
2222
#[argh(subcommand)]
23-
pub command: Command,
23+
command: Command,
2424
}
2525

26-
#[derive(FromArgs, Debug)]
26+
#[derive(FromArgs, PartialEq, Debug)]
2727
#[argh(subcommand)]
28-
pub enum Command {
28+
enum Command {
2929
Jump(JumpCmd),
3030
}
3131

32-
#[derive(FromArgs, Debug)]
32+
#[derive(FromArgs, PartialEq, Debug)]
3333
#[argh(subcommand, name = "jump", short = 'j')]
3434
/// whether or not to jump
35-
pub struct JumpCmd {}
35+
struct JumpCmd {}
3636

3737
fn main() {
3838
let args: CliArgs = argh::from_env();

argh/src/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@
322322
//!
323323
//! ```rust
324324
//! # use argh::FromArgs;
325-
//! #[derive(FromArgs, Debug)]
325+
//! #[derive(FromArgs, PartialEq, Debug)]
326326
//! #[argh(
327327
//! description = "{command_name} is a tool to reach new heights.\n\n\
328328
//! Start exploring new heights:\n\n\
@@ -333,7 +333,7 @@
333333
//! {command_name} --height 5 j\n\
334334
//! {command_name} --height 5 --pilot-nickname Wes jump"
335335
//! )]
336-
//! pub struct CliArgs {
336+
//! struct CliArgs {
337337
//! /// how high to go
338338
//! #[argh(option)]
339339
//! height: usize,
@@ -342,8 +342,12 @@
342342
//! pilot_nickname: Option<String>,
343343
//! /// command to execute
344344
//! #[argh(subcommand)]
345-
//! pub command: Command,
345+
//! command: Command,
346346
//! }
347+
//!
348+
//! # #[derive(FromArgs, PartialEq, Debug)]
349+
//! # #[argh(subcommand)]
350+
//! # enum Command {}
347351
//! ```
348352
//!
349353
//! Output:

0 commit comments

Comments
 (0)