Skip to content

harden ref mut according to edition 2024#1248

Merged
caspermeijn merged 2 commits intotokio-rs:masterfrom
tabokie:fix-ref-mut
Mar 28, 2025
Merged

harden ref mut according to edition 2024#1248
caspermeijn merged 2 commits intotokio-rs:masterfrom
tabokie:fix-ref-mut

Conversation

@tabokie
Copy link
Contributor

@tabokie tabokie commented Feb 25, 2025

Ref: https://doc.rust-lang.org/edition-guide/rust-2024/match-ergonomics.html

The direct impact of this is, some prost structs are modded in our codebase by (1) use cargo-expand to unfold prost implementation (2) use script to replace certain types. After upgrading to edition-2024 the output from (1) triggers complaint from rust.

Signed-off-by: Xinye Tao <xinye.tao@metabit-trading.com>
Copy link
Contributor

@caspermeijn caspermeijn left a comment

Choose a reason for hiding this comment

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

This makes sense. After this PR is merged, I will add a test to actually verify our generated code is compatible with edition 2024. #1256

Please see the suggestion below

Comment on lines -44 to -48
let MessageGraph {
ref mut index,
ref mut graph,
..
} = *self;
Copy link
Contributor

Choose a reason for hiding this comment

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

This change doesn't seem necessary for edition 2024, but it is an improvement nonetheless. The destructuring was probably needed in older compilers because of the usage of self inside and outside the closure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, cleaned it up while searching for ref mut.

Signed-off-by: Xinye Tao <xinye.tao@metabit-trading.com>
@caspermeijn caspermeijn added this pull request to the merge queue Mar 28, 2025
@caspermeijn
Copy link
Contributor

Thank you for your contribution

Merged via the queue into tokio-rs:master with commit db871b4 Mar 28, 2025
16 checks passed
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