Skip to content

Commit d30aff1

Browse files
steffahnTeXitoi
authored andcommitted
Improve doc code block formatting
1 parent 32d6e6d commit d30aff1

File tree

1 file changed

+32
-33
lines changed

1 file changed

+32
-33
lines changed

src/lib.rs

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,6 @@
435435
//! /// for its type (in this case 0).
436436
//! #[structopt(skip)]
437437
//! skipped: u32,
438-
//!
439438
//! }
440439
//!
441440
//! # Opt::from_iter(
@@ -452,7 +451,7 @@
452451
//! #[derive(StructOpt)]
453452
//! struct Opt {
454453
//! #[structopt(default_value = "", long)]
455-
//! prefix: String
454+
//! prefix: String,
456455
//! }
457456
//! ```
458457
//!
@@ -474,7 +473,7 @@
474473
//! struct Opt {
475474
//! // just leave the `= "..."` part and structopt will figure it for you
476475
//! #[structopt(default_value, long)]
477-
//! prefix: String // `String` implements both `Default` and `ToString`
476+
//! prefix: String, // `String` implements both `Default` and `ToString`
478477
//! }
479478
//! ```
480479
//!
@@ -499,8 +498,8 @@
499498
//! #[derive(StructOpt)]
500499
//! #[structopt(about = "I am a program and I work, just pass `-h`")]
501500
//! struct Foo {
502-
//! #[structopt(short, help = "Pass `-h` and you'll see me!")]
503-
//! bar: String
501+
//! #[structopt(short, help = "Pass `-h` and you'll see me!")]
502+
//! bar: String,
504503
//! }
505504
//! ```
506505
//!
@@ -513,8 +512,8 @@
513512
//! #[derive(StructOpt)]
514513
//! /// I am a program and I work, just pass `-h`
515514
//! struct Foo {
516-
//! /// Pass `-h` and you'll see me!
517-
//! bar: String
515+
//! /// Pass `-h` and you'll see me!
516+
//! bar: String,
518517
//! }
519518
//! ```
520519
//!
@@ -555,7 +554,7 @@
555554
//! /// until I'll have destroyed humanity. Enjoy your
556555
//! /// pathetic existence, you mere mortals.
557556
//! #[structopt(long)]
558-
//! kill_all_humans: bool
557+
//! kill_all_humans: bool,
559558
//! }
560559
//! ```
561560
//!
@@ -665,8 +664,8 @@
665664
//!
666665
//! #[derive(StructOpt)]
667666
//! struct Foo {
668-
//! #[structopt(short, long, env = "PARAMETER_VALUE")]
669-
//! parameter_value: String
667+
//! #[structopt(short, long, env = "PARAMETER_VALUE")]
668+
//! parameter_value: String,
670669
//! }
671670
//! ```
672671
//!
@@ -688,8 +687,8 @@
688687
//!
689688
//! #[derive(StructOpt)]
690689
//! struct Foo {
691-
//! #[structopt(long = "secret", env = "SECRET_VALUE", hide_env_values = true)]
692-
//! secret_value: String
690+
//! #[structopt(long = "secret", env = "SECRET_VALUE", hide_env_values = true)]
691+
//! secret_value: String,
693692
//! }
694693
//! ```
695694
//!
@@ -707,8 +706,8 @@
707706
//!
708707
//! #[derive(StructOpt)]
709708
//! struct Foo {
710-
//! #[structopt(long = "secret", env)]
711-
//! secret_value: String
709+
//! #[structopt(long = "secret", env)]
710+
//! secret_value: String,
712711
//! }
713712
//! ```
714713
//!
@@ -774,21 +773,21 @@
774773
//! #[structopt(short)]
775774
//! patch: bool,
776775
//! #[structopt(parse(from_os_str))]
777-
//! files: Vec<PathBuf>
776+
//! files: Vec<PathBuf>,
778777
//! },
779778
//! Fetch {
780779
//! #[structopt(long)]
781780
//! dry_run: bool,
782781
//! #[structopt(long)]
783782
//! all: bool,
784-
//! repository: Option<String>
783+
//! repository: Option<String>,
785784
//! },
786785
//! Commit {
787786
//! #[structopt(short)]
788787
//! message: Option<String>,
789788
//! #[structopt(short)]
790-
//! all: bool
791-
//! }
789+
//! all: bool,
790+
//! },
792791
//! }
793792
//! ```
794793
//!
@@ -807,22 +806,22 @@
807806
//! supervising_faerie: String,
808807
//! /// The faerie tree this cookie is being made in.
809808
//! tree: Option<String>,
810-
//! #[structopt(subcommand)] // Note that we mark a field as a subcommand
811-
//! cmd: Command
809+
//! #[structopt(subcommand)] // Note that we mark a field as a subcommand
810+
//! cmd: Command,
812811
//! }
813812
//!
814813
//! #[derive(StructOpt)]
815814
//! enum Command {
816815
//! /// Pound acorns into flour for cookie dough.
817816
//! Pound {
818-
//! acorns: u32
817+
//! acorns: u32,
819818
//! },
820819
//! /// Add magical sparkles -- the secret ingredient!
821820
//! Sparkle {
822821
//! #[structopt(short, parse(from_occurrences))]
823822
//! magicality: u64,
824823
//! #[structopt(short)]
825-
//! color: String
824+
//! color: String,
826825
//! },
827826
//! Finish(Finish),
828827
//! }
@@ -832,19 +831,19 @@
832831
//! struct Finish {
833832
//! #[structopt(short)]
834833
//! time: u32,
835-
//! #[structopt(subcommand)] // Note that we mark a field as a subcommand
836-
//! finish_type: FinishType
834+
//! #[structopt(subcommand)] // Note that we mark a field as a subcommand
835+
//! finish_type: FinishType,
837836
//! }
838837
//!
839838
//! // subsubcommand!
840839
//! #[derive(StructOpt)]
841840
//! enum FinishType {
842841
//! Glaze {
843-
//! applications: u32
842+
//! applications: u32,
844843
//! },
845844
//! Powder {
846845
//! flavor: String,
847-
//! dips: u32
846+
//! dips: u32,
848847
//! }
849848
//! }
850849
//! ```
@@ -868,14 +867,14 @@
868867
//! struct Foo {
869868
//! file: String,
870869
//! #[structopt(subcommand)]
871-
//! cmd: Option<Command>
870+
//! cmd: Option<Command>,
872871
//! }
873872
//!
874873
//! #[derive(StructOpt)]
875874
//! enum Command {
876875
//! Bar,
877876
//! Baz,
878-
//! Quux
877+
//! Quux,
879878
//! }
880879
//! ```
881880
//!
@@ -953,7 +952,7 @@
953952
//! BaseCli(BaseCli),
954953
//! Dex {
955954
//! arg2: i32,
956-
//! }
955+
//! },
957956
//! }
958957
//! ```
959958
//!
@@ -1068,10 +1067,10 @@
10681067
//!
10691068
//! // a struct with single custom argument
10701069
//! #[derive(StructOpt)]
1071-
//! struct GenericArgs<T:FromStr> where <T as FromStr>::Err: fmt::Display + fmt::Debug {
1070+
//! struct GenericArgs<T: FromStr> where <T as FromStr>::Err: fmt::Display + fmt::Debug {
10721071
//! generic_arg_1: String,
10731072
//! generic_arg_2: String,
1074-
//! custom_arg_1: T
1073+
//! custom_arg_1: T,
10751074
//! }
10761075
//! ```
10771076
//!
@@ -1081,11 +1080,11 @@
10811080
//! # use structopt::StructOpt;
10821081
//! // a struct with multiple custom arguments in a substructure
10831082
//! #[derive(StructOpt)]
1084-
//! struct GenericArgs<T:StructOpt> {
1083+
//! struct GenericArgs<T: StructOpt> {
10851084
//! generic_arg_1: String,
10861085
//! generic_arg_2: String,
10871086
//! #[structopt(flatten)]
1088-
//! custom_args: T
1087+
//! custom_args: T,
10891088
//! }
10901089
//! ```
10911090

0 commit comments

Comments
 (0)