From 4bb0559ab898d6321c61ce1ca4a8bd902d243b5b Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Sat, 10 Sep 2022 02:14:42 +0200 Subject: [PATCH] Fix a few typos --- CHANGELOG.md | 2 +- allowed_bindings.rs | 2 +- crates/macros/src/module.rs | 4 ++-- guide/src/types/closure.md | 2 +- src/boxed.rs | 6 +++--- src/builders/class.rs | 2 +- src/builders/function.rs | 2 +- src/class.rs | 2 +- src/convert.rs | 2 +- src/describe/stub.rs | 2 +- src/exception.rs | 6 ++++-- src/lib.rs | 4 ++-- src/macros.rs | 2 +- src/types/array.rs | 2 +- src/types/callable.rs | 2 +- src/types/class_object.rs | 8 ++++---- src/zend/ex.rs | 2 +- windows_build.rs | 2 +- 18 files changed, 28 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e4a961075..457613aea0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -170,7 +170,7 @@ Thanks to the contributors for this release: successfully with overwrite. - `push()` now returns a `Result`. - Converting from a `Vec` or `HashMap` to a `ZendHashTable` is fallible, so - it now implementes `TryFrom` as opposed to `From`. + it now implements `TryFrom` as opposed to `From`. - For `Zval`: - `set_string()` now returns a `Result`, and takes a second parameter (persistent). diff --git a/allowed_bindings.rs b/allowed_bindings.rs index bd3a651f28..f417e95ba4 100644 --- a/allowed_bindings.rs +++ b/allowed_bindings.rs @@ -1,5 +1,5 @@ // This is a cheeky hack - since we need the list of allowed bindings in both -// the build script and in the CLI crate (in differnet formats), we define the +// the build script and in the CLI crate (in different formats), we define the // `allowed_bindings.rs` file, which calls a macro called `bind` that doesn't // exist in the bindings file. Which ever script include!s the bindings must // define the `bind` macro. This allows us to have the list in string format diff --git a/crates/macros/src/module.rs b/crates/macros/src/module.rs index 83703f1c1a..2f2712321a 100644 --- a/crates/macros/src/module.rs +++ b/crates/macros/src/module.rs @@ -170,7 +170,7 @@ impl Describe for Function { let name = &self.name; let ret = if let Some((ty, null)) = &self.output { let ty: Type = syn::parse_str(ty) - .expect("unreachable - failed to parse previosuly parsed function return type"); + .expect("unreachable - failed to parse previously parsed function return type"); quote! { Some(Retval { ty: <#ty as ::ext_php_rs::convert::IntoZval>::TYPE, @@ -300,7 +300,7 @@ impl Describe for crate::method::Method { } }); let ret = if let Some((ty, null)) = &self.output { - let ty: Type = syn::parse_str(ty).expect("failed to parse previosuly parsed type"); + let ty: Type = syn::parse_str(ty).expect("failed to parse previously parsed type"); quote! { Some(Retval { ty: <#ty as ::ext_php_rs::convert::IntoZval>::TYPE, diff --git a/guide/src/types/closure.md b/guide/src/types/closure.md index d1586caa52..19ddfd435c 100644 --- a/guide/src/types/closure.md +++ b/guide/src/types/closure.md @@ -14,7 +14,7 @@ ext-php-rs = { version = "...", features = ["closure"] } PHP callables (which includes closures) can be passed to Rust through the `Callable` type. When calling a callable, you must provide it with a `Vec` of -arguemnts, all of which must implement `IntoZval` and `Clone`. +arguments, all of which must implement `IntoZval` and `Clone`. | `T` parameter | `&T` parameter | `T` Return type | `&T` Return type | PHP representation | | ------------- | -------------- | -------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------ | diff --git a/src/boxed.rs b/src/boxed.rs index b4dcd33182..fb61edc7af 100644 --- a/src/boxed.rs +++ b/src/boxed.rs @@ -62,7 +62,7 @@ impl ZBox { pub fn into_raw(self) -> &'static mut T { let mut this = ManuallyDrop::new(self); // SAFETY: All constructors ensure the contained pointer is well-aligned and - // dereferencable. + // dereferenceable. unsafe { this.0.as_mut() } } } @@ -80,7 +80,7 @@ impl Deref for ZBox { #[inline] fn deref(&self) -> &Self::Target { // SAFETY: All constructors ensure the contained pointer is well-aligned and - // dereferencable. + // dereferenceable. unsafe { self.0.as_ref() } } } @@ -89,7 +89,7 @@ impl DerefMut for ZBox { #[inline] fn deref_mut(&mut self) -> &mut Self::Target { // SAFETY: All constructors ensure the contained pointer is well-aligned and - // dereferencable. + // dereferenceable. unsafe { self.0.as_mut() } } } diff --git a/src/builders/class.rs b/src/builders/class.rs index c715600e35..bc03847545 100644 --- a/src/builders/class.rs +++ b/src/builders/class.rs @@ -38,7 +38,7 @@ impl ClassBuilder { pub fn new>(name: T) -> Self { Self { name: name.into(), - // SAFETY: A zeroed class entry is in an initalized state, as it is a raw C type + // SAFETY: A zeroed class entry is in an initialized state, as it is a raw C type // whose fields do not have a drop implementation. ce: unsafe { MaybeUninit::zeroed().assume_init() }, extends: None, diff --git a/src/builders/function.rs b/src/builders/function.rs index 1fd3bbf2dc..363aad2439 100644 --- a/src/builders/function.rs +++ b/src/builders/function.rs @@ -96,7 +96,7 @@ impl<'a> FunctionBuilder<'a> { /// # Parameters /// /// * `type_` - The return type of the function. - /// * `as_ref` - Whether the fucntion returns a reference. + /// * `as_ref` - Whether the function returns a reference. /// * `allow_null` - Whether the function return value is nullable. pub fn returns(mut self, type_: DataType, as_ref: bool, allow_null: bool) -> Self { self.retval = Some(type_); diff --git a/src/class.rs b/src/class.rs index 6985f93f56..c02a53fa18 100644 --- a/src/class.rs +++ b/src/class.rs @@ -59,7 +59,7 @@ pub struct ConstructorMeta { pub enum ConstructorResult { /// Successfully constructed the class, contains the new class object. Ok(T), - /// An exception occured while constructing the class. + /// An exception occurred while constructing the class. Exception(PhpException), /// Invalid arguments were given to the constructor. ArgError, diff --git a/src/convert.rs b/src/convert.rs index 1b0347726b..878237011f 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -75,7 +75,7 @@ where /// let props: HashMap = obj.extract(); /// ``` /// -/// Should be functionally equivalent to casting an object to another compatable +/// Should be functionally equivalent to casting an object to another compatible /// type. pub trait FromZendObject<'a>: Sized { /// Extracts `Self` from the source `ZendObject`. diff --git a/src/describe/stub.rs b/src/describe/stub.rs index 067d720602..ab1660c925 100644 --- a/src/describe/stub.rs +++ b/src/describe/stub.rs @@ -340,7 +340,7 @@ fn split_namespace(class: &str) -> (StdOption<&str>, &str) { /// to be appended. Returns a new string with the new indentation. Will not /// indent whitespace lines. /// -/// # Paramters +/// # Parameters /// /// * `s` - The string to indent. /// * `depth` - The depth to indent the lines to, in spaces. diff --git a/src/exception.rs b/src/exception.rs index 7ec5932834..d1504b46c5 100644 --- a/src/exception.rs +++ b/src/exception.rs @@ -88,7 +88,8 @@ impl From for PhpException { /// Throws an exception with a given message. See [`ClassEntry`] for some /// built-in exception types. /// -/// Returns a result containing nothing if the exception was successfully thown. +/// Returns a result containing nothing if the exception was successfully +/// thrown. /// /// # Parameters /// @@ -109,7 +110,8 @@ pub fn throw(ex: &ClassEntry, message: &str) -> Result<()> { /// Throws an exception with a given message and status code. See [`ClassEntry`] /// for some built-in exception types. /// -/// Returns a result containing nothing if the exception was successfully thown. +/// Returns a result containing nothing if the exception was successfully +/// thrown. /// /// # Parameters /// diff --git a/src/lib.rs b/src/lib.rs index 61fef130a0..f056133c88 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -172,7 +172,7 @@ pub use ext_php_rs_derive::php_extern; /// /// You are able to implement [`FromZval`] on your own custom types to have /// arguments passed in seamlessly. Similarly, you can implement [`IntoZval`] on -/// values that you want to be able to be returned from PHP fucntions. +/// values that you want to be able to be returned from PHP functions. /// /// Parameters may be deemed optional by passing the parameter name into the /// attribute options. Note that all parameters that are optional (which @@ -317,7 +317,7 @@ pub use ext_php_rs_derive::php_function; /// contents of the `impl` block are to be exported to PHP. /// /// The only contrary to this is setting the visibility, optional argument and -/// default arguments for methods. These are done through seperate macros: +/// default arguments for methods. These are done through separate macros: /// /// - `#[defaults(key = value, ...)]` for setting defaults of method variables, /// similar to the diff --git a/src/macros.rs b/src/macros.rs index 5b3e2487ed..47f255bed9 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -102,7 +102,7 @@ macro_rules! call_user_func { /// ``` /// /// This example is similar to the one above, apart from the fact that the `z` -/// argument is not required. Note the semicolon seperating the first two +/// argument is not required. Note the semicolon separating the first two /// arguments from the second. /// /// ``` diff --git a/src/types/array.rs b/src/types/array.rs index b8769adf25..d39105e497 100644 --- a/src/types/array.rs +++ b/src/types/array.rs @@ -360,7 +360,7 @@ impl ZendHashTable { } /// Pushes an item onto the end of the hash table. Returns a result - /// containing nothing if the element was sucessfully inserted. + /// containing nothing if the element was successfully inserted. /// /// # Parameters /// diff --git a/src/types/callable.rs b/src/types/callable.rs index 17bd3b3c85..c1e446e6ea 100644 --- a/src/types/callable.rs +++ b/src/types/callable.rs @@ -42,7 +42,7 @@ impl<'a> ZendCallable<'a> { /// /// # Parameters /// - /// * `callable` - TThe underlying [`Zval`] that is callable. + /// * `callable` - The underlying [`Zval`] that is callable. pub fn new_owned(callable: Zval) -> Result { if callable.is_callable() { Ok(Self(OwnedZval::Owned(callable))) diff --git a/src/types/class_object.rs b/src/types/class_object.rs index 09f37aa918..f926c02b7d 100644 --- a/src/types/class_object.rs +++ b/src/types/class_object.rs @@ -83,7 +83,7 @@ impl ZendClassObject { /// /// Providing an initialized variant of [`MaybeUninit`] is safe. /// - /// Providing an uninitalized variant of [`MaybeUninit`] is unsafe. As + /// Providing an uninitialized variant of [`MaybeUninit`] is unsafe. As /// the object is uninitialized, the caller must ensure the following /// until the internal object is initialized: /// @@ -115,7 +115,7 @@ impl ZendClassObject { object_properties_init(&mut obj.std, ce); // SAFETY: `obj` is non-null and well aligned as it is a reference. - // As the data in `obj.obj` is uninitalized, we don't want to drop + // As the data in `obj.obj` is uninitialized, we don't want to drop // the data, but directly override it. ptr::write(&mut obj.obj, val); @@ -234,7 +234,7 @@ impl Deref for ZendClassObject { fn deref(&self) -> &Self::Target { self.obj .as_ref() - .expect("Attempted to access uninitalized class object") + .expect("Attempted to access uninitialized class object") } } @@ -242,7 +242,7 @@ impl DerefMut for ZendClassObject { fn deref_mut(&mut self) -> &mut Self::Target { self.obj .as_mut() - .expect("Attempted to access uninitalized class object") + .expect("Attempted to access uninitialized class object") } } diff --git a/src/zend/ex.rs b/src/zend/ex.rs index 37949d47eb..f14e62c7ee 100644 --- a/src/zend/ex.rs +++ b/src/zend/ex.rs @@ -199,7 +199,7 @@ impl ExecuteData { /// /// The resultant zval reference has a lifetime equal to the lifetime of /// `self`. This isn't specified because when you attempt to get a - /// reference to args and the `$this` object, Rust doesnt't let you. + /// reference to args and the `$this` object, Rust doesn't let you. /// Since this is a private method it's up to the caller to ensure the /// lifetime isn't exceeded. #[doc(hidden)] diff --git a/windows_build.rs b/windows_build.rs index 39638cdfc9..bc0e75d895 100644 --- a/windows_build.rs +++ b/windows_build.rs @@ -98,7 +98,7 @@ impl<'a> PHPProvider<'a> for Provider<'a> { /// Returns the path to rustc's linker. fn get_rustc_linker() -> Result { - // `RUSTC_LINKER` is set if the linker has been overriden anywhere. + // `RUSTC_LINKER` is set if the linker has been overridden anywhere. if let Ok(link) = std::env::var("RUSTC_LINKER") { return Ok(link.into()); }