Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

deserialize_individually macro fails clippy due to unnecessary mut

Đang mở
#149 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
rust
Lĩnh vực
tooling

Hướng nghiên cứu

Mở src/arena/saveload.rs và kiểm tra macro deserialize_individually, đặc biệt là đối số entities được truyền vào DeserializeComponents::deserialize. Chạy Clippy để xác nhận cảnh báo về tham chiếu có thể thay đổi không cần thiết, sau đó xác minh rằng cảnh báo đã biến mất trong khi quá trình deserialize vẫn hoạt động.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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)
Ngôn ngữ chính
Rust
Star
967
Fork
166
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của amethyst/rustrogueliketutorial

Tất cả issue của amethyst/rustrogueliketutorial

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.