From f42dc0c37708a7baa0c4e44e7d73ccb258069cb3 Mon Sep 17 00:00:00 2001 From: Joshua Groves Date: Sun, 14 Feb 2021 23:09:08 -0330 Subject: [PATCH] Fix some typos --- src/back/glsl/features.rs | 2 +- src/back/glsl/mod.rs | 36 ++++++++++++++++++------------------ src/front/glsl/ast.rs | 4 ++-- src/front/glsl/constants.rs | 10 +++++----- src/front/glsl/error.rs | 2 +- src/front/glsl/parser.rs | 2 +- src/front/spv/flow.rs | 2 +- src/front/wgsl/mod.rs | 2 +- src/lib.rs | 2 +- src/proc/typifier.rs | 2 +- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/back/glsl/features.rs b/src/back/glsl/features.rs index b714476570..4f75cbd097 100644 --- a/src/back/glsl/features.rs +++ b/src/back/glsl/features.rs @@ -6,7 +6,7 @@ use crate::{ use std::io::Write; bitflags::bitflags! { - /// Structure used to encode a set of addittions to glsl that aren't supported by all versions + /// Structure used to encode a set of additions to glsl that aren't supported by all versions pub struct Features: u32 { /// Buffer storage class support const BUFFER_STORAGE = 1; diff --git a/src/back/glsl/mod.rs b/src/back/glsl/mod.rs index 9bccb86818..d695f69548 100644 --- a/src/back/glsl/mod.rs +++ b/src/back/glsl/mod.rs @@ -96,7 +96,7 @@ impl Version { /// /// # Notes /// As an invalid version number will never be added to the supported version list - /// so this also checks for verson validity + /// so this also checks for version validity fn is_supported(&self) -> bool { match self { Version::Desktop(v) => SUPPORTED_CORE_VERSIONS.contains(v), @@ -131,7 +131,7 @@ pub struct Options { pub version: Version, /// The name and stage of the entry point /// - /// If no enty point that matches is found a error will be thrown while creating a new instance + /// If no entry point that matches is found a error will be thrown while creating a new instance /// of [`Writer`](struct.Writer.html) pub entry_point: (ShaderStage, String), } @@ -293,7 +293,7 @@ impl<'a, W: Write> Writer<'a, W> { return Err(Error::VersionNotSupported); } - // Try to find the entry point and correspoding index + // Try to find the entry point and corresponding index let (ep_idx, ep) = module .entry_points .iter() @@ -473,9 +473,9 @@ impl<'a, W: Write> Writer<'a, W> { // Write all regular functions that are in the call graph this is important // because other functions might require for example globals that weren't written for node in functions { - // We do this inside the loop instead of using `map` to sastify the borrow checker + // We do this inside the loop instead of using `map` to satisfy the borrow checker let handle = self.call_graph[node]; - // We also `clone` to sastify the borrow checker + // We also `clone` to satisfy the borrow checker let name = self.names[&NameKey::Function(handle)].clone(); // Write the function @@ -508,7 +508,7 @@ impl<'a, W: Write> Writer<'a, W> { /// Helper method used to write non image/sampler types /// /// # Notes - /// Adds no trailing or leading whitespaces + /// Adds no trailing or leading whitespace /// /// # Panics /// - If type is either a image or sampler @@ -608,7 +608,7 @@ impl<'a, W: Write> Writer<'a, W> { // Panic if either Image or Sampler is being written // // Write all variants instead of `_` so that if new variants are added a - // no exhaustivenes error is thrown + // no exhaustiveness error is thrown TypeInner::Image { .. } | TypeInner::Sampler { .. } => unreachable!(), } @@ -618,7 +618,7 @@ impl<'a, W: Write> Writer<'a, W> { /// Helper method to write a image type /// /// # Notes - /// Adds no leading or trailing whitespaces + /// Adds no leading or trailing whitespace fn write_image_type( &mut self, dim: crate::ImageDimension, @@ -793,7 +793,7 @@ impl<'a, W: Write> Writer<'a, W> { write!(self.out, "void")?; } - // Write the function name and open parantheses for the argument list + // Write the function name and open parentheses for the argument list write!(self.out, " {}(", name.as_ref())?; // Write the comma separated argument list @@ -812,7 +812,7 @@ impl<'a, W: Write> Writer<'a, W> { Ok(()) })?; - // Close the parantheses and open braces to start the function body + // Close the parentheses and open braces to start the function body writeln!(self.out, ") {{")?; // Write all function locals @@ -865,7 +865,7 @@ impl<'a, W: Write> Writer<'a, W> { /// a reference to the element `T` being written /// /// # Notes - /// - Adds no newlines or leading/trailing whitespaces + /// - Adds no newlines or leading/trailing whitespace /// - The last element won't have a trailing `,` fn write_slice BackendResult>( &mut self, @@ -889,7 +889,7 @@ impl<'a, W: Write> Writer<'a, W> { /// Helper method used to write constants /// /// # Notes - /// Adds no newlines or leading/trailing whitespaces + /// Adds no newlines or leading/trailing whitespace fn write_constant(&mut self, constant: &Constant) -> BackendResult { match constant.inner { ConstantInner::Scalar { @@ -903,7 +903,7 @@ impl<'a, W: Write> Writer<'a, W> { // While `core` doesn't necessarily need it, it's allowed and since `es` needs it we // always write it as the extra branch wouldn't have any benefit in readability ScalarValue::Uint(int) => write!(self.out, "{}u", int)?, - // Floats are written using `Debug` insted of `Display` because it always appends the + // Floats are written using `Debug` instead of `Display` because it always appends the // decimal part even it's zero which is needed for a valid glsl float constant ScalarValue::Float(float) => write!(self.out, "{:?}", float)?, // Booleans are either `true` or `false` so nothing special needs to be done @@ -1029,7 +1029,7 @@ impl<'a, W: Write> Writer<'a, W> { // Switch are written as in C: // ``` // switch (selector) { - // // Falltrough + // // Fallthrough // case label: // block // // Non fallthrough @@ -1463,7 +1463,7 @@ impl<'a, W: Write> Writer<'a, W> { // `Binary` we just write `left op right`, except when dealing with // comparison operations on vectors as they are implemented with // builtin functions. - // Once again we wrap everything in parantheses to avoid precedence issues + // Once again we wrap everything in parentheses to avoid precedence issues Expression::Binary { op, left, right } => { // Holds `Some(function_name)` if the binary operation is // implemented as a function call @@ -1521,7 +1521,7 @@ impl<'a, W: Write> Writer<'a, W> { write!(self.out, ")")? } // `Select` is written as `condition ? accept : reject` - // We wrap everything in parantheses to avoid precedence issues + // We wrap everything in parentheses to avoid precedence issues Expression::Select { condition, accept, @@ -1849,7 +1849,7 @@ fn glsl_built_in(built_in: BuiltIn) -> &'static str { } } -/// Helper function that returns the string correspoding to the storage class +/// Helper function that returns the string corresponding to the storage class fn glsl_storage_class(class: StorageClass) -> &'static str { match class { StorageClass::Function => "", @@ -1864,7 +1864,7 @@ fn glsl_storage_class(class: StorageClass) -> &'static str { } } -/// Helper function that returns the string correspoding to the glsl interpolation qualifier +/// Helper function that returns the string corresponding to the glsl interpolation qualifier /// /// # Errors /// If [`Patch`](crate::Interpolation::Patch) is passed, as it isn't supported in glsl diff --git a/src/front/glsl/ast.rs b/src/front/glsl/ast.rs index bcad2b05db..0d5ba6b7f6 100644 --- a/src/front/glsl/ast.rs +++ b/src/front/glsl/ast.rs @@ -78,7 +78,7 @@ impl Program { _ => false, }; - let rigth_is_vector = match self.resolve_type(right.expression)? { + let right_is_vector = match self.resolve_type(right.expression)? { crate::TypeInner::Vector { .. } => true, _ => false, }; @@ -95,7 +95,7 @@ impl Program { right: right.expression, })); - Ok(if left_is_vector && rigth_is_vector { + Ok(if left_is_vector && right_is_vector { ExpressionRule::from_expression(self.context.expressions.append( Expression::Relational { fun, diff --git a/src/front/glsl/constants.rs b/src/front/glsl/constants.rs index 14f748a0fa..ba0e7381ee 100644 --- a/src/front/glsl/constants.rs +++ b/src/front/glsl/constants.rs @@ -189,13 +189,13 @@ impl<'a> ConstantSolver<'a> { match inner { ConstantInner::Scalar { ref mut value, .. } => { - let intial = value.clone(); + let initial = value.clone(); *value = match kind { - ScalarKind::Sint => ScalarValue::Sint(inner_cast(intial)), - ScalarKind::Uint => ScalarValue::Uint(inner_cast(intial)), - ScalarKind::Float => ScalarValue::Float(inner_cast(intial)), - ScalarKind::Bool => ScalarValue::Bool(inner_cast::(intial) != 0), + ScalarKind::Sint => ScalarValue::Sint(inner_cast(initial)), + ScalarKind::Uint => ScalarValue::Uint(inner_cast(initial)), + ScalarKind::Float => ScalarValue::Float(inner_cast(initial)), + ScalarKind::Bool => ScalarValue::Bool(inner_cast::(initial) != 0), } } ConstantInner::Composite { diff --git a/src/front/glsl/error.rs b/src/front/glsl/error.rs index 5c2d6f44c2..2a85370865 100644 --- a/src/front/glsl/error.rs +++ b/src/front/glsl/error.rs @@ -47,7 +47,7 @@ impl fmt::Display for ErrorKind { ErrorKind::UnknownField(meta, val) => write!(f, "Unknown field {} at {:?}", val, meta), #[cfg(feature = "glsl-validate")] ErrorKind::VariableAlreadyDeclared(val) => { - write!(f, "Variable {} already decalred in current scope", val) + write!(f, "Variable {} already declared in current scope", val) } #[cfg(feature = "glsl-validate")] ErrorKind::VariableNotAvailable(val) => { diff --git a/src/front/glsl/parser.rs b/src/front/glsl/parser.rs index bb7d473b92..0e1748311d 100644 --- a/src/front/glsl/parser.rs +++ b/src/front/glsl/parser.rs @@ -1145,7 +1145,7 @@ pomelo! { extra.context.lookup_constant_exps.insert(id, expr); } } else { - return Err(ErrorKind::SemanticError("Constants must have an initalizer".into())) + return Err(ErrorKind::SemanticError("Constants must have an initializer".into())) } } } diff --git a/src/front/spv/flow.rs b/src/front/spv/flow.rs index c11a1eda0f..9a6c113665 100644 --- a/src/front/spv/flow.rs +++ b/src/front/spv/flow.rs @@ -191,7 +191,7 @@ impl FlowGraph { /// Removes OpPhi instructions from the control flow graph and turns them into ordinary variables. /// - /// Phi instructions are not supported inside Naga nor do they exist as instructions on CPUs. It is neccessary + /// Phi instructions are not supported inside Naga nor do they exist as instructions on CPUs. It is necessary /// to remove them and turn into ordinary variables before converting to Naga's IR and shader code. pub(super) fn remove_phi_instructions( &mut self, diff --git a/src/front/wgsl/mod.rs b/src/front/wgsl/mod.rs index a34a5ef0a4..b096dc6ea1 100644 --- a/src/front/wgsl/mod.rs +++ b/src/front/wgsl/mod.rs @@ -1888,7 +1888,7 @@ impl Parser { // read function name let mut lookup_ident = FastHashMap::default(); let fun_name = lexer.next_ident()?; - // populare initial expressions + // populate initial expressions let mut expressions = Arena::new(); for (&name, expression) in lookup_global_expression.iter() { let expr_handle = expressions.append(expression.clone()); diff --git a/src/lib.rs b/src/lib.rs index 38f78345d6..f37eb625c4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -402,7 +402,7 @@ pub enum ScalarValue { Bool(bool), } -/// Additional information, dependendent on the kind of constant. +/// Additional information, dependent on the kind of constant. #[derive(Debug, PartialEq, Clone)] #[cfg_attr(feature = "serialize", derive(Serialize))] #[cfg_attr(feature = "deserialize", derive(Deserialize))] diff --git a/src/proc/typifier.rs b/src/proc/typifier.rs index c97309e495..9bea6137cc 100644 --- a/src/proc/typifier.rs +++ b/src/proc/typifier.rs @@ -30,7 +30,7 @@ impl Clone for Resolution { width, }, #[allow(clippy::panic)] - _ => panic!("Unepxected clone type: {:?}", v), + _ => panic!("Unexpected clone type: {:?}", v), }), } }