fix most typos, add crate-ci/typos to CI (#2653)

* fix most typos, add crate-ci/typos to CI

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
Tristan F.andJonathan Kelley authored and GitHub committed 2024-07-23 17:49:33 -07:00
1 parent 841b447d2a
commit 9167cd9dec
83 files changed
+258 -203

No files matched your search

+9 -9
View File
@@ -92,25 +92,25 @@ impl VirtualDom {
}
impl ElementPath {
pub(crate) fn is_decendant(&self, small: &[u8]) -> bool {
pub(crate) fn is_descendant(&self, small: &[u8]) -> bool {
small.len() <= self.path.len() && small == &self.path[..small.len()]
}
}
#[test]
fn is_decendant() {
fn is_descendant() {
let event_path = ElementPath {
path: &[1, 2, 3, 4, 5],
};
assert!(event_path.is_decendant(&[1, 2, 3, 4, 5]));
assert!(event_path.is_decendant(&[1, 2, 3, 4]));
assert!(event_path.is_decendant(&[1, 2, 3]));
assert!(event_path.is_decendant(&[1, 2]));
assert!(event_path.is_decendant(&[1]));
assert!(event_path.is_descendant(&[1, 2, 3, 4, 5]));
assert!(event_path.is_descendant(&[1, 2, 3, 4]));
assert!(event_path.is_descendant(&[1, 2, 3]));
assert!(event_path.is_descendant(&[1, 2]));
assert!(event_path.is_descendant(&[1]));
assert!(!event_path.is_decendant(&[1, 2, 3, 4, 5, 6]));
assert!(!event_path.is_decendant(&[2, 3, 4]));
assert!(!event_path.is_descendant(&[1, 2, 3, 4, 5, 6]));
assert!(!event_path.is_descendant(&[2, 3, 4]));
}
impl PartialEq<&[u8]> for ElementPath {
+1 -1
View File
@@ -344,7 +344,7 @@ impl Mutations {
/// Rewrites IDs to just be "template", so you can compare the mutations
///
/// Used really only for testing
pub fn santize(mut self) -> Self {
pub fn sanitize(mut self) -> Self {
for edit in self.edits.iter_mut() {
if let Mutation::LoadTemplate { name, .. } = edit {
*name = "template"
+6 -6
View File
@@ -193,7 +193,7 @@ impl Drop for VNode {
// FIXME:
// TODO:
//
// We have to add this drop *here* becase we can't add a drop impl to AttributeValue and
// We have to add this drop *here* because we can't add a drop impl to AttributeValue and
// keep semver compatibility. Adding a drop impl means you can't destructure the value, which
// we need to do for enums.
//
@@ -546,7 +546,7 @@ impl TemplateNode {
/// A node created at runtime
///
/// This node's index in the DynamicNode list on VNode should match its repsective `Dynamic` index
/// This node's index in the DynamicNode list on VNode should match its respective `Dynamic` index
#[derive(Debug)]
pub enum DynamicNode {
/// A component node
@@ -761,7 +761,7 @@ pub struct Attribute {
impl Attribute {
/// Create a new [`Attribute`] from a name, value, namespace, and volatile bool
///
/// "Volatile" referes to whether or not Dioxus should always override the value. This helps prevent the UI in
/// "Volatile" refers to whether or not Dioxus should always override the value. This helps prevent the UI in
/// some renderers stay in sync with the VirtualDom's understanding of the world
pub fn new(
name: &'static str,
@@ -1145,8 +1145,8 @@ pub trait HasAttributes {
#[cfg(debug_assertions)]
pub(crate) fn sort_bfo(paths: &[&'static [u8]]) -> Vec<(usize, &'static [u8])> {
let mut with_indecies = paths.iter().copied().enumerate().collect::<Vec<_>>();
with_indecies.sort_by(|(_, a), (_, b)| {
let mut with_indices = paths.iter().copied().enumerate().collect::<Vec<_>>();
with_indices.sort_by(|(_, a), (_, b)| {
let mut a = a.iter();
let mut b = b.iter();
loop {
@@ -1163,7 +1163,7 @@ pub(crate) fn sort_bfo(paths: &[&'static [u8]]) -> Vec<(usize, &'static [u8])> {
}
}
});
with_indecies
with_indices
}
#[test]
+1 -1
View File
@@ -162,7 +162,7 @@ impl ReactiveContext {
/// # use futures_util::StreamExt;
/// fn use_simplified_memo(mut closure: impl FnMut() -> i32 + 'static) -> Signal<i32> {
/// use_hook(|| {
/// // Create a new reactive context and channel that will recieve a value every time a value the reactive context subscribes to changes
/// // Create a new reactive context and channel that will receive a value every time a value the reactive context subscribes to changes
/// let (reactive_context, mut changed) = ReactiveContext::new();
/// // Compute the value of the memo inside the reactive context. This will subscribe the reactive context to any values you read inside the closure
/// let value = reactive_context.reset_and_run_in(&mut closure);
+1 -1
View File
@@ -6,7 +6,7 @@ use std::{cell::Ref, rc::Rc};
/// A component's unique identifier.
///
/// `ScopeId` is a `usize` that acts a key for the internal slab of Scopes. This means that the key is not unqiue across
/// `ScopeId` is a `usize` that acts a key for the internal slab of Scopes. This means that the key is not unique across
/// time. We do try and guarantee that between calls to `wait_for_work`, no ScopeIds will be recycled in order to give
/// time for any logic that relies on these IDs to properly update.
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+1 -1
View File
@@ -887,7 +887,7 @@ impl VirtualDom {
for attr in attrs.iter() {
// Remove the "on" prefix if it exists, TODO, we should remove this and settle on one
if attr.name.get(2..) == Some(name) && target_path.is_decendant(this_path) {
if attr.name.get(2..) == Some(name) && target_path.is_descendant(this_path) {
listeners.push(&attr.value);
// Break if this is the exact target element.