Skip to content

Commit

Permalink
Remove most ignores and the should_panic from code blocks in docu…
Browse files Browse the repository at this point in the history
…mentation
  • Loading branch information
steffahn authored and TeXitoi committed Sep 17, 2021
1 parent d30aff1 commit 701d6dd
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
//!
//! First, let's look at the example:
//!
//! ```should_panic
//! ```
//! use std::path::PathBuf;
//! use structopt::StructOpt;
//!
Expand Down Expand Up @@ -95,7 +95,10 @@
//! }
//!
//! fn main() {
//! # /*
//! let opt = Opt::from_args();
//! # */
//! # let opt = Opt::from_iter(&["binary", "-o", "stdout", "input"]);
//! println!("{:?}", opt);
//! }
//! ```
Expand Down Expand Up @@ -134,13 +137,17 @@
//! They are what used to be explicit `#[structopt(raw(...))]` attrs in pre-0.3 `structopt`
//!
//! Every `structopt attribute` looks like comma-separated sequence of methods:
//! ```rust,ignore
//! ```
//! # #[derive(structopt::StructOpt)] struct S {
//! #
//! #[structopt(
//! short, // method with no arguments - always magical
//! long = "--long-option", // method with one argument
//! required_if("out", "file"), // method with one and more args
//! parse(from_os_str = path::to::parser) // some magical methods have their own syntax
//! )]
//! #
//! # s: () } mod path { pub(crate) mod to { pub(crate) fn parser(_: &std::ffi::OsStr) {} }}
//! ```
//!
//! `#[structopt(...)]` attributes can be placed on top of `struct`, `enum`,
Expand Down Expand Up @@ -174,11 +181,15 @@
//! They are the reason why `structopt` is so flexible. **Every and each method from
//! `clap::App/Arg` can be used this way!**
//!
//! ```ignore
//! ```
//! # #[derive(structopt::StructOpt)] struct S {
//! #
//! #[structopt(
//! global = true, // name = arg form, neat for one-arg methods
//! required_if("out", "file") // name(arg1, arg2, ...) form.
//! )]
//! #
//! # s: String }
//! ```
//!
//! The first form can only be used for methods which take only one argument.
Expand Down Expand Up @@ -631,7 +642,7 @@
//! Also, `structopt` will *still* remove leading and trailing blank lines so
//! these formats are equivalent:
//!
//! ```ignore
//! ```
//! /** This is a doc comment
//!
//! Hello! */
Expand All @@ -645,6 +656,8 @@
//! /// This is a doc comment
//! ///
//! /// Hello!
//! #
//! # mod m {}
//! ```
//! ______________
//!
Expand Down

0 comments on commit 701d6dd

Please sign in to comment.