Skip to content

fix: remove invalid #[serde(flatten)] from branch deserialization test#49

Merged
bashandbone merged 1 commit intomainfrom
copilot/fix-ci-failing-tests
Apr 6, 2026
Merged

fix: remove invalid #[serde(flatten)] from branch deserialization test#49
bashandbone merged 1 commit intomainfrom
copilot/fix-ci-failing-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 6, 2026

test_branch_deserialize_from_toml_rejects_empty_and_whitespace was panicking with can only flatten structs and maps instead of the expected invalid branch value error, because SerializableBranch deserializes as a plain string — incompatible with serde's flatten, which requires a struct or map.

Changes

  • src/options.rs: Remove #[serde(flatten)] from the local Helper struct in the test. A plain named field is sufficient since toml::from_str with branch = "" maps directly to Helper { branch: SerializableBranch }, correctly delegating to SerializableBranch's deserializer and surfacing the invalid branch value error.
  • Add #[expect(dead_code)] on the field to suppress the resulting lint (field is consumed only via deserialization).
// Before — wrong: SerializableBranch is a string, not a map
struct Helper {
    #[serde(flatten)]
    branch: SerializableBranch,
}

// After — correct
struct Helper {
    #[expect(dead_code)]
    branch: SerializableBranch,
}

@bashandbone bashandbone marked this pull request as ready for review April 6, 2026 18:34
Copilot AI review requested due to automatic review settings April 6, 2026 18:34
@bashandbone bashandbone merged commit 6791c3c into main Apr 6, 2026
1 check passed
@bashandbone bashandbone deleted the copilot/fix-ci-failing-tests branch April 6, 2026 18:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a failing/panicking TOML deserialization test by removing an invalid #[serde(flatten)] usage on a string-backed type, ensuring the test exercises SerializableBranch’s deserializer and produces the intended “invalid branch value” error.

Changes:

  • Remove #[serde(flatten)] from the test-only Helper wrapper struct used for TOML parsing.
  • Add #[expect(dead_code)] to suppress the resulting “unused field” warning for a field only populated via deserialization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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