-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat(pruner, metrics): skip
attribute for metrics derive macro
#4069
Conversation
Codecov Report
... and 8 files with indirect coverage changes
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
reasonable feature.
lgtm
Meta::Path(path) if path.is_ident("skip") => skip = true, | ||
Meta::NameValue(kv) => { | ||
let lit = match kv.value { | ||
Expr::Lit(ref expr) => &expr.lit, | ||
_ => continue, |
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.
simple
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.
one smol nit. could we also get tests the skip fields being at the end of the struct, in the middle and having multiple consecutive/separate skip fields
.fold( | ||
(vec![], vec![], vec![]), | ||
|(mut defaults, mut labeled_defaults, mut describes), | ||
(default, labeled_default, describe)| { |
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.
let's avoid using keywords as var names
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.
ah, didn't know it's a keyword from nightly feature, fixed
…know which one to use instead
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.
beautiful
Allows to skip certain struct fields which are not intended to be parsed as metrics:
reth/crates/prune/src/metrics.rs
Lines 5 to 12 in bf37faf