Skip to content

diffguard-testkit: DiffBuilder/HunkBuilder builder methods silently no-op if result unused #571

@EffortlessSteven

Description

@EffortlessSteven

Location:

Problem: and use a builder pattern where methods like , , , , , , and all return . However, they lack attributes.

Why this is a bug: A caller who writes:

...will get a builder with zero lines/hunks, with no warning at compile time. The caller's intent (adding content) is silently ignored. This is especially insidious in tests.

Evidence from clippy:
#[must_use]Self#[must_use]Self#[must_use]Self#[must_use]Self

Fix: Add to all builder methods that return in and .

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions