Fix all spelling mistakes in history by typos tool

This commit is contained in:
Cautreoxit
2024-08-26 15:31:58 +08:00
committed by Tate, Hongliang Tian
parent b29d3b5409
commit 86f09eef75
120 changed files with 255 additions and 213 deletions

View File

@ -31,5 +31,5 @@ fn main() {
## Introduction
This crate provides a derive procedural macro named `TryFromInt`. This macro will automatically implement [TryFrom](https://doc.rust-lang.org/core/convert/trait.TryFrom.html) trait for enums that meet the following requirements:
1. The enum must have a primitive repr, i.e., the enum should have attribute like #[repr(u8)], #[repr(u32)], etc. The type parameter of TryFrom will be the repr, e.g., in the `QuickStart` example, the macro will implment `TryFrom<u8>` for `Color`.
1. The enum must have a primitive repr, i.e., the enum should have attribute like #[repr(u8)], #[repr(u32)], etc. The type parameter of TryFrom will be the repr, e.g., in the `QuickStart` example, the macro will implement `TryFrom<u8>` for `Color`.
2. The enum must consist solely of unit variants, which is called [units only enum](https://doc.rust-lang.org/reference/items/enumerations.html#unit-only-enum). Each field should have an **explicit discriminant**.

View File

@ -69,8 +69,8 @@ fn fn_body_tokens(value_name: &str, data_enum: &DataEnum, ident: Ident) -> Token
.discriminant
.as_ref()
.expect("Each field must be assigned a discriminant value explicitly");
let vairant_ident = &variant.ident;
let statement = quote!(#value => ::core::result::Result::Ok(#ident::#vairant_ident),);
let variant_ident = &variant.ident;
let statement = quote!(#value => ::core::result::Result::Ok(#ident::#variant_ident),);
match_bodys.append_all(statement);
}
match_bodys.append_all(