Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add derive macro to strip enum of data #39
Add derive macro to strip enum of data #39
Changes from 30 commits
030d866
f038775
923fe56
308254d
8822de7
145297a
50720a8
107e190
11f1dbb
dd3e75b
c967b81
71fe83a
5c56d07
21b0b3e
4ddac45
bc8b714
5a32040
5103330
11b45f1
6cd39ae
d36d436
33bc53a
cea85c5
e6bda77
29c4b82
bdd2808
4ab8954
d513acf
27a5075
9d8a461
6f634db
722cdf5
fd88940
53cdd70
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handle potential parsing errors instead of using
unwrap()
Using
unwrap()
onlist.parse_args_with(list_parser)
may cause a panic if parsing fails. It's better to handle the error gracefully and provide a helpful error message to the user.Apply this diff to handle the error:
📝 Committable suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Ensure correct matching of attributes to avoid unexpected behavior
The pattern matching in the
ignore_variant
function may incorrectly handle attributes that are not#[stripped(...)]
, potentially causing unintended aborts. Ensure that only the relevant attributes are processed and others are ignored gracefully.Consider refining the match statement to handle only the
#[stripped(...)]
attributes and skip others without aborting. Here's a suggested change:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid potential panics by handling parsing errors
The use of
unwrap()
oninfo_attr.parse_args_with(ident_parser)
can lead to a panic if parsing fails. Consider handling the error to prevent unexpected panics and provide clearer error messages.Apply this diff:
📝 Committable suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consistent attribute parsing and error handling
In the
strip_enum
function, the parsing of the#[stripped]
attribute should handle errors gracefully and consistently, similar to the previous suggestions.Apply this diff:
📝 Committable suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace
unwrap()
with error handling to prevent panicsCalling
parse_args::<syn::Meta>().unwrap()
can cause a panic if the parsing fails. It's advisable to handle the error and provide a meaningful message.Apply this diff:
📝 Committable suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Improve parsing of
stripped_meta
attributes and error handlingThe current implementation may not handle multiple
#[stripped_meta(...)]
attributes correctly and usesunwrap()
which can panic. Consider parsing all attributes properly and handling errors.Here's a suggested change:
📝 Committable suggestion