Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

deserialize_individually macro fails clippy due to unnecessary mut

Open
#149 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
rust
Domain
tooling

Research direction

Open src/arena/saveload.rs and inspect the deserialize_individually macro, especially the entities argument passed to DeserializeComponents::deserialize. Run Clippy to confirm the unnecessary mutable-reference warning, then verify that the warning is gone while deserialization still works.

Written by the indexing model from the issue text.

Description

Here https://bfnightly.bracketproductions.com/rustbook/chapter_11.html#actually-loading-the-game

This code:


macro_rules! deserialize_individually {
    ($ecs:expr, $de:expr, $data:expr, $( $type:ty),*) => {
        $(
        DeserializeComponents::<NoError, _>::deserialize(
            &mut ( &mut $ecs.write_storage::<$type>(), ),
            &mut $data.0, // entities

can be


macro_rules! deserialize_individually {
    ($ecs:expr, $de:expr, $data:expr, $( $type:ty),*) => {
        $(
        DeserializeComponents::<NoError, _>::deserialize(
            &mut ( &mut $ecs.write_storage::<$type>(), ),
            &$data.0, // entities

to prevent this clippy warning:

warning: The function/method `DeserializeComponents<NoError, _>::deserialize` doesn't need a mutable reference
   --> src/arena/saveload.rs:35:13
    |
35  |               &mut $data.0, // entities
    |               ^^^^^^^^^^^^
...
115 | /         deserialize_individually!(
116 | |             ecs,
117 | |             de,
118 | |             d,
...   |
135 | |             SerializationHelper
136 | |         );
    | |__________- in this macro invocation
    |
    = note: `#[warn(clippy::unnecessary_mut_passed)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
    = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

warning: The function/method `DeserializeComponents<NoError, _>::deserialize` doesn't need a mutable reference
   --> src/arena/saveload.rs:35:13
    |
35  |               &mut $data.0, // entities
    |               ^^^^^^^^^^^^
...
115 | /         deserialize_individually!(
116 | |             ecs,
117 | |             de,
118 | |             d,
...   |
135 | |             SerializationHelper
136 | |         );
    | |__________- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
    = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
Dominant language
Rust
Stars
967
Forks
166
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from amethyst/rustrogueliketutorial

All issues in amethyst/rustrogueliketutorial

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.