diff --git a/README.md b/README.md index 63a7458..b4a4182 100644 --- a/README.md +++ b/README.md @@ -387,7 +387,7 @@ But I am Ukrainian. The first 25 years of my life I spent in [Kharkiv](https://e the second-largest city in Ukraine, 60km away from the border with russia. Today about [a third of my home city is destroyed](https://www.youtube.com/watch?v=ihoufBFSZds) by russians. My parents, my relatives and my friends had to survive the artillery and air attack, living for over a month in basements. -Some of them have managed to evacuate to EU. Some others are trying to live "normal lifes" in Kharkiv, doing there daily duties. +Some of them have managed to evacuate to EU. Some others are trying to live "normal lives" in Kharkiv, doing there daily duties. And some are at the front line right now, risking their lives every second to protect the rest. I encourage you to donate to [Charity foundation of Serhiy Prytula](https://prytulafoundation.org/en). diff --git a/WORKLOG.md b/WORKLOG.md index ef55ccc..0fcdb48 100644 --- a/WORKLOG.md +++ b/WORKLOG.md @@ -6,7 +6,7 @@ ### TODO Refactor: * Refactor parsers -* Try to generelize the parsing, validation and generation over types +* Try to generalize the parsing, validation and generation over types ### TODO UI: * UI: Impl "did you mean" hints: @@ -34,7 +34,7 @@ * truncate * Remove extra spaces * Extra validations for floats: - * `is_number` / `is_finite` (aka not NaN, and not `Inifinity`) + * `is_number` / `is_finite` (aka not NaN, and not `Infinity`) * This should allow to derive Eq and Ord * Consider extending errors to keep the invalid value? diff --git a/nutype/src/lib.rs b/nutype/src/lib.rs index 9a792b7..1759315 100644 --- a/nutype/src/lib.rs +++ b/nutype/src/lib.rs @@ -395,7 +395,7 @@ //! the second-largest city in Ukraine, 60km away from the border with russia. Today about [a third of my home city is destroyed](https://www.youtube.com/watch?v=ihoufBFSZds) by russians. //! My parents, my relatives and my friends had to survive the artillery and air attack, living for over a month in basements. //! -//! Some of them have managed to evacuate to EU. Some others are trying to live "normal lifes" in Kharkiv, doing there daily duties. +//! Some of them have managed to evacuate to EU. Some others are trying to live "normal lives" in Kharkiv, doing there daily duties. //! And some are at the front line right now, risking their lives every second to protect the rest. //! //! I encourage you to donate to [Charity foundation of Serhiy Prytula](https://prytulafoundation.org/en). diff --git a/nutype_macros/src/any/gen/traits.rs b/nutype_macros/src/any/gen/traits.rs index 05aeb8a..7a743ed 100644 --- a/nutype_macros/src/any/gen/traits.rs +++ b/nutype_macros/src/any/gen/traits.rs @@ -8,7 +8,7 @@ use crate::{ common::{ gen::traits::{ gen_impl_trait_as_ref, gen_impl_trait_borrow, gen_impl_trait_default, - gen_impl_trait_deref, gen_impl_trait_dislpay, gen_impl_trait_from, + gen_impl_trait_deref, gen_impl_trait_display, gen_impl_trait_from, gen_impl_trait_from_str, gen_impl_trait_into, gen_impl_trait_serde_deserialize, gen_impl_trait_serde_serialize, gen_impl_trait_try_from, split_into_generatable_traits, GeneratableTrait, GeneratableTraits, GeneratedTraits, @@ -144,7 +144,7 @@ fn gen_implemented_traits( AnyIrregularTrait::AsRef => gen_impl_trait_as_ref(type_name, inner_type), AnyIrregularTrait::From => gen_impl_trait_from(type_name, inner_type), AnyIrregularTrait::Into => gen_impl_trait_into(type_name, inner_type.clone()), - AnyIrregularTrait::Display => gen_impl_trait_dislpay(type_name), + AnyIrregularTrait::Display => gen_impl_trait_display(type_name), AnyIrregularTrait::Deref => gen_impl_trait_deref(type_name, inner_type), AnyIrregularTrait::Borrow => gen_impl_trait_borrow(type_name, inner_type), AnyIrregularTrait::FromStr => { diff --git a/nutype_macros/src/any/parse.rs b/nutype_macros/src/any/parse.rs index 000de50..ed3ccd6 100644 --- a/nutype_macros/src/any/parse.rs +++ b/nutype_macros/src/any/parse.rs @@ -49,9 +49,9 @@ impl Parse for SpannedAnySanitizer { AnySanitizerKind::With => { let _eq: Token![=] = input.parse()?; let span = input.span(); - let custom_funciton: CustomFunction = input.parse()?; + let custom_function: CustomFunction = input.parse()?; Ok(SpannedAnySanitizer { - item: AnySanitizer::With(custom_funciton), + item: AnySanitizer::With(custom_function), span, }) } @@ -67,9 +67,9 @@ impl Parse for SpannedAnyValidator { AnyValidatorKind::Predicate => { let _eq: Token![=] = input.parse()?; let span = input.span(); - let custom_funciton: CustomFunction = input.parse()?; + let custom_function: CustomFunction = input.parse()?; Ok(SpannedAnyValidator { - item: AnyValidator::Predicate(custom_funciton), + item: AnyValidator::Predicate(custom_function), span, }) } diff --git a/nutype_macros/src/common/gen/traits.rs b/nutype_macros/src/common/gen/traits.rs index ad36c50..2320fef 100644 --- a/nutype_macros/src/common/gen/traits.rs +++ b/nutype_macros/src/common/gen/traits.rs @@ -89,7 +89,7 @@ pub fn gen_impl_trait_deref(type_name: &TypeName, inner_type: impl ToTokens) -> } } -pub fn gen_impl_trait_dislpay(type_name: &TypeName) -> TokenStream { +pub fn gen_impl_trait_display(type_name: &TypeName) -> TokenStream { quote! { impl ::core::fmt::Display for #type_name { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { diff --git a/nutype_macros/src/common/models.rs b/nutype_macros/src/common/models.rs index 85183ec..5ac89ce 100644 --- a/nutype_macros/src/common/models.rs +++ b/nutype_macros/src/common/models.rs @@ -140,7 +140,7 @@ macro_rules! define_ident_type { // For example: `Username`, `Email`, etc. define_ident_type!(TypeName); -// Repesents a type for a validation error. +// Represents a type for a validation error. // For example, if `TypeName` is `Email`, then `ErrorTypeName` would usually be `EmailError`. define_ident_type!(ErrorTypeName); diff --git a/nutype_macros/src/float/gen/traits.rs b/nutype_macros/src/float/gen/traits.rs index 90033af..68fb9ab 100644 --- a/nutype_macros/src/float/gen/traits.rs +++ b/nutype_macros/src/float/gen/traits.rs @@ -7,7 +7,7 @@ use crate::{ common::{ gen::traits::{ gen_impl_trait_as_ref, gen_impl_trait_borrow, gen_impl_trait_default, - gen_impl_trait_deref, gen_impl_trait_dislpay, gen_impl_trait_from, + gen_impl_trait_deref, gen_impl_trait_display, gen_impl_trait_from, gen_impl_trait_from_str, gen_impl_trait_into, gen_impl_trait_serde_deserialize, gen_impl_trait_serde_serialize, gen_impl_trait_try_from, split_into_generatable_traits, GeneratableTrait, GeneratableTraits, GeneratedTraits, @@ -168,7 +168,7 @@ fn gen_implemented_traits( gen_impl_trait_try_from(type_name, inner_type, maybe_error_type_name.as_ref()) } FloatIrregularTrait::Borrow => gen_impl_trait_borrow(type_name, inner_type), - FloatIrregularTrait::Display => gen_impl_trait_dislpay(type_name), + FloatIrregularTrait::Display => gen_impl_trait_display(type_name), FloatIrregularTrait::Default => match maybe_default_value { Some(ref default_value) => { let has_validation = maybe_error_type_name.is_some(); @@ -200,7 +200,7 @@ fn gen_impl_trait_eq(type_name: &TypeName) -> TokenStream { // The implementation below may panic. // Function `partial_cmp` returns `None` only for `NaN` values, but -// `NaN` values are supposed to be exluded by `finite` validation rule. +// `NaN` values are supposed to be excluded by `finite` validation rule. // Without `finite` validation deriving `Ord` is not allowed. fn gen_impl_trait_ord(type_name: &TypeName) -> TokenStream { let tp = type_name.to_string(); diff --git a/nutype_macros/src/integer/gen/traits/mod.rs b/nutype_macros/src/integer/gen/traits/mod.rs index 91a5e74..8c74ceb 100644 --- a/nutype_macros/src/integer/gen/traits/mod.rs +++ b/nutype_macros/src/integer/gen/traits/mod.rs @@ -9,7 +9,7 @@ use crate::{ common::{ gen::traits::{ gen_impl_trait_as_ref, gen_impl_trait_borrow, gen_impl_trait_default, - gen_impl_trait_deref, gen_impl_trait_dislpay, gen_impl_trait_from, + gen_impl_trait_deref, gen_impl_trait_display, gen_impl_trait_from, gen_impl_trait_from_str, gen_impl_trait_into, gen_impl_trait_serde_deserialize, gen_impl_trait_serde_serialize, gen_impl_trait_try_from, split_into_generatable_traits, GeneratableTrait, GeneratableTraits, GeneratedTraits, @@ -196,7 +196,7 @@ fn gen_implemented_traits( Ok(gen_impl_trait_try_from(type_name, inner_type, maybe_error_type_name.as_ref())) } IntegerIrregularTrait::Borrow => Ok(gen_impl_trait_borrow(type_name, inner_type)), - IntegerIrregularTrait::Display => Ok(gen_impl_trait_dislpay(type_name)), + IntegerIrregularTrait::Display => Ok(gen_impl_trait_display(type_name)), IntegerIrregularTrait::Default => { match maybe_default_value { Some(ref default_value) => { diff --git a/nutype_macros/src/string/gen/traits.rs b/nutype_macros/src/string/gen/traits.rs index 41275b3..d37515d 100644 --- a/nutype_macros/src/string/gen/traits.rs +++ b/nutype_macros/src/string/gen/traits.rs @@ -7,7 +7,7 @@ use crate::{ common::{ gen::traits::{ gen_impl_trait_as_ref, gen_impl_trait_borrow, gen_impl_trait_default, - gen_impl_trait_deref, gen_impl_trait_dislpay, gen_impl_trait_from, gen_impl_trait_into, + gen_impl_trait_deref, gen_impl_trait_display, gen_impl_trait_from, gen_impl_trait_into, gen_impl_trait_serde_deserialize, gen_impl_trait_serde_serialize, gen_impl_trait_try_from, split_into_generatable_traits, GeneratableTrait, GeneratableTraits, GeneratedTraits, @@ -181,7 +181,7 @@ fn gen_implemented_traits( gen_impl_try_from(type_name, maybe_error_type_name.as_ref()) } StringIrregularTrait::Borrow => gen_impl_borrow_str_and_string(type_name), - StringIrregularTrait::Display => gen_impl_trait_dislpay(type_name), + StringIrregularTrait::Display => gen_impl_trait_display(type_name), StringIrregularTrait::Default => match maybe_default_value { Some(ref default_value) => { let has_validation = maybe_error_type_name.is_some(); diff --git a/test_suite/tests/string.rs b/test_suite/tests/string.rs index 3d5e3ce..6a1cf9e 100644 --- a/test_suite/tests/string.rs +++ b/test_suite/tests/string.rs @@ -101,7 +101,7 @@ mod validators { assert_eq!(Name::new("Anton").unwrap().into_inner(), "Anton"); assert_eq!(Name::new("Serhii"), Err(NameError::LenCharMaxViolated)); - // Ukranian, Cyrillic. Every char is 2 bytes. + // Ukrainian, Cyrillic. Every char is 2 bytes. assert_eq!(Name::new("Антон").unwrap().into_inner(), "Антон"); } @@ -113,7 +113,7 @@ mod validators { assert_eq!(Name::new("Anton"), Err(NameError::LenCharMinViolated)); assert_eq!(Name::new("Serhii").unwrap().into_inner(), "Serhii"); - // Ukranian, Cyrillic. Every char is 2 bytes. + // Ukrainian, Cyrillic. Every char is 2 bytes. assert_eq!(Name::new("Антон"), Err(NameError::LenCharMinViolated)); }