amethyst / amethyst/rustrogueliketutorial

deserialize_individually macro fails clippy due to unnecessary mut

オープン
#149 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
970
フォーク
166
PR マージ指標
30日以内にマージされた PR はありません

説明

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::::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::::deserialize(
&mut ( &mut $ecs.write_storage::<$type>(), ),
&$data.0, // entities
```
to prevent this clippy warning:
```
warning: The function/method `DeserializeComponents::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::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)
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。