Skip to content

Commit

Permalink
Merge pull request #86 from MultisampledNight/fix-typos
Browse files Browse the repository at this point in the history
Fix a few typos
  • Loading branch information
someguynamedjosh authored Jun 14, 2023
2 parents 8f5919a + 7f9901c commit 8cd8fbc
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fn main() {
float_reference_builder: |float_data: &mut f32| float_data,
}.build();

// The fields in the original struct can not be accesed directly
// The fields in the original struct can not be accessed directly
// The builder creates accessor methods which are called borrow_{field_name}()

// Prints 42
Expand Down
6 changes: 3 additions & 3 deletions ouroboros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
/// float_reference_builder: |float_data: &mut f32| float_data,
/// }.build();
///
/// // The fields in the original struct can not be accesed directly
/// // The fields in the original struct can not be accessed directly
/// // The builder creates accessor methods which are called borrow_{field_name}()
///
/// // Prints 42
Expand Down Expand Up @@ -303,12 +303,12 @@
/// ### `MyStructAsyncSendBuilder`
/// Same as MyStructAsyncBuilder, but with Send trait specified in the return type.
/// ### `MyStruct::try_new<E>(fields...) -> Result<MyStruct, E>`
/// Similar to the regular `new()` function, except the functions wich create values for all
/// Similar to the regular `new()` function, except the functions which create values for all
/// **self-referencing fields** can return `Result<>`s. If any of those are `Err`s, that error will be
/// returned instead of an instance of `MyStruct`. The preferred way to use this function is through
/// `MyStructTryBuilder` and its `try_build()` function.
/// ### `MyStruct::try_new_async<E>(fields...) -> Result<MyStruct, E>`
/// Similar to the regular `new_async()` function, except the functions wich create values for all
/// Similar to the regular `new_async()` function, except the functions which create values for all
/// **self-referencing fields** can return `Result<>`s. If any of those are `Err`s, that error will be
/// returned instead of an instance of `MyStruct`. The preferred way to use this function is through
/// `MyStructAsyncTryBuilder` and its `try_build()` function.
Expand Down
4 changes: 2 additions & 2 deletions ouroboros_macro/src/generate/constructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn create_builder_and_constructor(
.to_owned();
let build_fn_documentation = format!(
concat!(
"Calls [`{0}::new()`]({0}::new) using the provided values. This is preferrable over ",
"Calls [`{0}::new()`]({0}::new) using the provided values. This is preferable over ",
"calling `new()` directly for the reasons listed above. "
),
info.ident.to_string()
Expand Down Expand Up @@ -80,7 +80,7 @@ pub fn create_builder_and_constructor(
);
} else if let ArgType::TraitBound(bound_type) = arg_type {
// Trait bounds are much trickier. We need a special syntax to accept them in the
// contructor, and generic parameters need to be added to the builder struct to make
// constructor, and generic parameters need to be added to the builder struct to make
// it work.
let builder_name = field.builder_name();
params.push(quote! { #builder_name : impl #bound_type });
Expand Down
2 changes: 1 addition & 1 deletion ouroboros_macro/src/generate/summon_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn generate_checker_summoner(info: &StructInfo) -> Result<TokenStream, Error
params.push(quote! { #field_name: #plain_type });
} else if let ArgType::TraitBound(bound_type) = arg_type {
// Trait bounds are much trickier. We need a special syntax to accept them in the
// contructor, and generic parameters need to be added to the builder struct to make
// constructor, and generic parameters need to be added to the builder struct to make
// it work.
let builder_name = field.builder_name();
params.push(quote! { #builder_name : impl #bound_type });
Expand Down
8 changes: 4 additions & 4 deletions ouroboros_macro/src/generate/try_constructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub fn create_try_builder_and_constructor(
let builder_documentation = concat!(
"A more verbose but stable way to construct self-referencing structs. It is ",
"comparable to using `StructName { field1: value1, field2: value2 }` rather than ",
"`StructName::new(value1, value2)`. This has the dual benefit of makin your code ",
"`StructName::new(value1, value2)`. This has the dual benefit of making your code ",
"both easier to refactor and more readable. Call [`try_build()`](Self::try_build) or ",
"[`try_build_or_recover()`](Self::try_build_or_recover) to ",
"construct the actual struct. The fields of this struct should be used as follows:\n\n",
Expand All @@ -69,14 +69,14 @@ pub fn create_try_builder_and_constructor(
let build_fn_documentation = format!(
concat!(
"Calls [`{0}::try_new()`]({0}::try_new) using the provided values. This is ",
"preferrable over calling `try_new()` directly for the reasons listed above. "
"preferable over calling `try_new()` directly for the reasons listed above. "
),
info.ident.to_string()
);
let build_or_recover_fn_documentation = format!(
concat!(
"Calls [`{0}::try_new_or_recover()`]({0}::try_new_or_recover) using the provided ",
"values. This is preferrable over calling `try_new_or_recover()` directly for the ",
"values. This is preferable over calling `try_new_or_recover()` directly for the ",
"reasons listed above. "
),
info.ident.to_string()
Expand Down Expand Up @@ -118,7 +118,7 @@ pub fn create_try_builder_and_constructor(
}
} else if let ArgType::TraitBound(bound_type) = arg_type {
// Trait bounds are much trickier. We need a special syntax to accept them in the
// contructor, and generic parameters need to be added to the builder struct to make
// constructor, and generic parameters need to be added to the builder struct to make
// it work.
let builder_name = field.builder_name();
params.push(quote! { #builder_name : impl #bound_type });
Expand Down
2 changes: 1 addition & 1 deletion ouroboros_macro/src/generate/with_each.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pub fn make_with_functions(info: &StructInfo, options: Options) -> Result<Vec<To
}
});
} else if field.field_type == FieldType::BorrowedMut {
// Do not generate anything becaue if it is borrowed mutably once, we should not be able
// Do not generate anything because if it is borrowed mutably once, we should not be able
// to get any other kinds of references to it.
}
}
Expand Down
4 changes: 2 additions & 2 deletions ouroboros_macro/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use syn::{spanned::Spanned, Attribute, Error, Fields, GenericParam, ItemStruct};
use crate::{
covariance_detection::type_is_covariant_over_this_lifetime,
info_structures::{BorrowRequest, Derive, FieldType, StructFieldInfo, StructInfo},
utils::submodule_contents_visiblity,
utils::submodule_contents_visibility,
};

fn handle_borrows_attr(
Expand Down Expand Up @@ -188,7 +188,7 @@ pub fn parse_struct(def: &ItemStruct) -> Result<StructInfo, Error> {
}
// We should not be able to access the field outside of the hidden module where
// everything is generated.
let with_vis = submodule_contents_visiblity(&field.vis.clone());
let with_vis = submodule_contents_visibility(&field.vis.clone());
fields.push(StructFieldInfo {
name: field.ident.clone().expect("Named field has no name."),
typ: field.ty.clone(),
Expand Down
2 changes: 1 addition & 1 deletion ouroboros_macro/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub fn replace_this_with_lifetime(input: TokenStream, lifetime: Ident) -> TokenS
.collect()
}

pub fn submodule_contents_visiblity(original_visibility: &Visibility) -> Visibility {
pub fn submodule_contents_visibility(original_visibility: &Visibility) -> Visibility {
match original_visibility {
// inherited: allow parent of inner submodule to see
Visibility::Inherited => syn::parse_quote! { pub(super) },
Expand Down

0 comments on commit 8cd8fbc

Please sign in to comment.