Skip to content

A few clippy fixes #381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charon/macros/src/enum_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn to_snake_case(s: &str) -> String {
// "I32" -> "I3_2"
let mut last_is_lowercase = false;

for (_, c) in s.chars().enumerate() {
for c in s.chars() {
if c.is_uppercase() {
if last_is_lowercase {
snake_case.push('_');
Expand Down
3 changes: 3 additions & 0 deletions charon/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub fn derive_variant_index_arity(item: TokenStream) -> TokenStream {
}

/// Macro `EnumIsA`
///
/// Derives functions of the form `fn is_{variant_name}(&self) -> bool` returning true
/// if an enumeration instance is of some variant. For lists, it would generate
/// `is_cons` and `is_nil`.
Expand All @@ -40,6 +41,7 @@ pub fn derive_enum_is_a(item: TokenStream) -> TokenStream {
}

/// Macro `EnumAsGetters`
///
/// Derives functions of the form `fn as_{variant_name}(&self) -> ...` checking
/// that an enumeration instance is of the proper variant and returning shared
/// borrows to its fields.
Expand All @@ -59,6 +61,7 @@ pub fn derive_enum_as_getters(item: TokenStream) -> TokenStream {
}

/// Macro `EnumToGetters`
///
/// Derives functions of the form `fn to_{variant_name}(self) -> ...` checking
/// that an enumeration instance is of the proper variant and returning its
/// fields (while consuming the instance).
Expand Down
Loading