Skip to content

Commit

Permalink
fix rust-analyzer incorrect-ident-case diagnostic
Browse files Browse the repository at this point in the history
Using the derive macro in a project with rust-analyzer gives an error
complaining that this generated code isn't in the SCREAMING_SNAKE_CASE
form. This change makes this diagnostic message go away.
  • Loading branch information
CobaltCause committed Jun 15, 2022
1 parent 282fb0e commit b3a3ef0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ repository = "https://github.com/rust-fuzz/arbitrary"
documentation = "https://docs.rs/arbitrary/"

[dependencies]
heck = "0.4"
proc-macro2 = "1.0"
quote = "1.0"
syn = { version = "1.0", features = ['derive'] }
Expand Down
3 changes: 2 additions & 1 deletion derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
extern crate proc_macro;

use heck::ToShoutySnakeCase;
use proc_macro2::{Span, TokenStream};
use quote::quote;
use syn::*;
Expand All @@ -13,7 +14,7 @@ pub fn derive_arbitrary(tokens: proc_macro::TokenStream) -> proc_macro::TokenStr
build_arbitrary_lifetime(input.generics.clone());

let recursive_count = syn::Ident::new(
&format!("RECURSIVE_COUNT_{}", input.ident),
&format!("RECURSIVE_COUNT_{}", input.ident.to_string().to_shouty_snake_case()),
Span::call_site(),
);

Expand Down

0 comments on commit b3a3ef0

Please sign in to comment.