Skip to content

refactor: remove automock to prevent must_use warnings for impl - #1843

Merged
severin-amrein merged 2 commits into
mainfrom
sev/refactor-must-use
Dec 15, 2025
Merged

refactor: remove automock to prevent must_use warnings for impl#1843
severin-amrein merged 2 commits into
mainfrom
sev/refactor-must-use

Conversation

@severin-amrein

@severin-amrein severin-amrein commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

This PR was caused by warnings of the following structure:

warning: `#[must_use]` attribute cannot be used on trait methods in impl blocks
   --> rs/cli/src/forum/mod.rs:148:5
    |
148 |     #[must_use = "You must not forget to update the proposal URL using the forum post this returns"]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = help: `#[must_use]` can be applied to data types, functions, unions, required trait methods, provided trait methods, inherent methods, foreign functions, and traits
    = note: `#[warn(unused_attributes)]` (part of `#[warn(unused)]`) on by default

They are caused by using automock that automatically creates mock impl including must_use. Since the mock functions are not used at the moment, this PR removes automock.

@severin-amrein
severin-amrein requested a review from a team as a code owner December 10, 2025 08:09
@severin-amrein
severin-amrein marked this pull request as draft December 10, 2025 08:10
@severin-amrein severin-amrein changed the title refactor: fix warning due to phase out of using must_use for trait methods in impl blocks refactor: remove automock to prevent must_use warning for impl Dec 15, 2025
@severin-amrein severin-amrein changed the title refactor: remove automock to prevent must_use warning for impl refactor: remove automock to prevent must_use warnings for impl Dec 15, 2025
@severin-amrein
severin-amrein marked this pull request as ready for review December 15, 2025 09:49

@NikolaMilosa NikolaMilosa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automock is used for testing.

Given that we don't have tests with this, and the CI is green I see no issues with merging this.

@severin-amrein
severin-amrein merged commit 75c7712 into main Dec 15, 2025
8 checks passed
@severin-amrein
severin-amrein deleted the sev/refactor-must-use branch December 15, 2025 09:53
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.

2 participants