-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Use #[automatically_derived]
in all generated code
#814
Comments
Hmm, I just noticed that the highlighted line is the one with the https://app.codecov.io/gh/clechasseur/aoc_leaderbot/pull/3/blob/aoc_leaderboard/src/aoc.rs#L22 It seems to highlight |
I don't think this is a problem with /// Information about the completion of a day in an [Advent of Code] event.
///
/// [Advent of Code]: https://adventofcode.com/
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub struct CompletionDayLevel {
/// Info about the completion of the day's part 1.
#[serde(rename = "1", with="PuzzleCompletionInfo")]
pub part_1: PuzzleCompletionInfo,
/// Info about the completion of the day's part 2.
///
/// Can be [`None`] if user has not yet solved part 2.
#[serde(rename = "2", default, skip_serializing_if = "Option::is_none")]
pub part_2: Option<PuzzleCompletionInfo>,
} As such, I think this is an issue with the normal serde derives. I took a quick look at serde, but didn't find a missing |
Thank you, and sorry if I entered the issue in the wrong project; debugging code coverage in macro-generated code is non-trivial and I guess I didn't put the finger on the right problem. I'll try to come up with a more minimal repro and look at the serde crate itself. Feel free to close this issue. |
No problem, such a debugging challenge is nice once in a while :) There was some recent stuff in the serde repo about the |
I am using
serde_with
in a small project and am seeing missing line coverage in my code coverage report, pointing to my#[derive]
directives. Apparently, this can be avoided by adding the#[automatically_derived]
attribute to generated code.I've done a quick search in this repository and it seems to be used already for some generated code, so I can only assume there are places it isn't used yet (I'm not very familiar with derive macro implementation so I can't be certain 🙂).
Here's an example of how I use
serde_with
:https://github.com/clechasseur/aoc_leaderbot/blob/fa643db51d692821b01c9094007f2434b1ecc371/aoc_leaderboard/src/aoc.rs#L40
This is not high-priority for me as I am just poking around a toy project, but I thought I'd report it in any case. If I can be of further assistance, don't hesitate to ask.
The text was updated successfully, but these errors were encountered: