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: allow non_snake_case and dead_code lints to run within component functions #3198

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yescallop
Copy link

Currently, the non_snake_case and dead_code lints will not run within component functions because the component macro emits allow attributes for the two lints, which allows room for users to make mistakes. This PR fixes the problem by converting the function name to snake case before prefixing it with __ and dropping the allow attributes for the two lints from the macro.

I have run cargo check on the library and all examples and see no additional warnings. We can have the CI confirm this.

@yescallop
Copy link
Author

The server_fns_axum example failed to build because there are multiple component and server functions with the same name but in different case (rkyv_example and RkyvExample, for example). I changed component and server macros to emit different prefixes (__leptos_component_ and __leptos_server_) to address the problem.

@yescallop
Copy link
Author

I don't know why, but I might've run into a cargo fmt bug touching seemingly unrelated code. I thought it would be better not to include those formatting changes, but apparently the CI would not be happy with that! So I included the changes and force-pushed again. Hopefully everything is OK now.

@rakshith-ravi
Copy link
Collaborator

Oh, nevermind, I see what happened here. Perhaps we can have a #[allow(non_snake_case, dead_code)] in the declaration, and another #[warn(non_snake_case, dead_code)] in the body to bring back the lint instead of changing the name of the fn or struct?

Not sure if that would work, but worth a shot

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.

2 participants