Skip to content
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

fix: use uppercase const name #1043

Merged
merged 1 commit into from
Jul 27, 2023
Merged

Conversation

chadoh
Copy link
Contributor

@chadoh chadoh commented Jul 24, 2023

What

This fixes an issue where Rust Analyzer sometimes complains that:

constant `symbol` should have UPPER_SNAKE_CASE name

Why

When using symbol_short!, as recommended by the Getting Started → Hello World tutorial, I was getting confusing warnings from Rust Analyzer:

image

Known limitations

Why not use this instead?

Ok(_) => quote! {
    #crate_path::Symbol::short(#s)
}

This fixes an issue where Rust Analyzer sometimes complains that:

   constant `symbol` should have UPPER_SNAKE_CASE name
@tomerweller tomerweller merged commit 4c51299 into stellar:main Jul 27, 2023
12 checks passed
@chadoh chadoh deleted the fix/uppercase-const branch July 27, 2023 21:56
leighmcculloch added a commit that referenced this pull request Aug 25, 2023
### What
Add doc comments about why symbol_short! is preferred over
Symbol::short.

### Why
The behavior of const functions when called in non-const-contexts is not
well known, as has been evidenced by the many times folks have asked why
we have symbol_short!, and the case where symbol_short! was removed with
folks assuming it was of no use. For example:
#1043 (comment).
Adding docs to knowledge share.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants