From 119d873bdd3ebfb4af1cc953f9871f52470ad6f7 Mon Sep 17 00:00:00 2001 From: Florian Jacob Date: Sat, 22 Dec 2018 19:33:01 +0100 Subject: [PATCH] Fix spelling: occurences -> occurrences, was found in comments and code, but required no user-facing API change. --- README.md | 2 +- examples/basic.rs | 2 +- structopt-derive/src/lib.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7b4fb36b..41c6d82a 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ struct Opt { #[structopt(short = "d", long = "debug")] debug: bool, - // The number of occurences of the `v/verbose` flag + // The number of occurrences of the `v/verbose` flag /// Verbose mode (-v, -vv, -vvv, etc.) #[structopt(short = "v", long = "verbose", parse(from_occurrences))] verbose: u8, diff --git a/examples/basic.rs b/examples/basic.rs index 8d322d6e..471718a3 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -22,7 +22,7 @@ struct Opt { #[structopt(short = "d", long = "debug")] debug: bool, - // The number of occurences of the `v/verbose` flag + // The number of occurrences of the `v/verbose` flag /// Verbose mode (-v, -vv, -vvv, etc.) #[structopt(short = "v", long = "verbose", parse(from_occurrences))] verbose: u8, diff --git a/structopt-derive/src/lib.rs b/structopt-derive/src/lib.rs index 0f73ef63..f0edce65 100644 --- a/structopt-derive/src/lib.rs +++ b/structopt-derive/src/lib.rs @@ -132,7 +132,7 @@ fn gen_augmentation( _ => &field.ty, }; - let occurences = attrs.parser().0 == Parser::FromOccurrences; + let occurrences = attrs.parser().0 == Parser::FromOccurrences; let validator = match *attrs.parser() { (Parser::TryFromStr, ref f) => quote! { @@ -152,7 +152,7 @@ fn gen_augmentation( Ty::Bool => quote!( .takes_value(false).multiple(false) ), Ty::Option => quote!( .takes_value(true).multiple(false) #validator ), Ty::Vec => quote!( .takes_value(true).multiple(true) #validator ), - Ty::Other if occurences => quote!( .takes_value(false).multiple(true) ), + Ty::Other if occurrences => quote!( .takes_value(false).multiple(true) ), Ty::Other => { let required = !attrs.has_method("default_value"); quote!( .takes_value(true).multiple(false).required(#required) #validator ) @@ -214,7 +214,7 @@ fn gen_constructor(fields: &Punctuated, parent_attribute: &Attrs) (FromOccurrences, ref f) => (quote!(occurrences_of), quote!(), f.clone()), }; - let occurences = attrs.parser().0 == Parser::FromOccurrences; + let occurrences = attrs.parser().0 == Parser::FromOccurrences; let name = attrs.cased_name(); let field_value = match ty { Ty::Bool => quote!(matches.is_present(#name)), @@ -228,7 +228,7 @@ fn gen_constructor(fields: &Punctuated, parent_attribute: &Attrs) .map(|v| v.map(#parse).collect()) .unwrap_or_else(Vec::new) }, - Ty::Other if occurences => quote! { + Ty::Other if occurrences => quote! { #parse(matches.#value_of(#name)) }, Ty::Other => quote! {