eclipse-zenoh / zenoh

zenoh unifies data in motion, data in-use, data at rest and computations. It carefully blends traditional pub/sub with geo-distributed storages, queries and computations, while retaining a level of time and space efficiency that is well beyond any of the mainstream stacks.
https://zenoh.io
Other
1.36k stars 142 forks source link

fix: fix clippy warnings for 1.79 #1139

Closed wyfo closed 3 weeks ago

wyfo commented 3 weeks ago

@Mallets

wyfo commented 3 weeks ago

I'm honestly worried about having so much transmute in the code (I've replaced a few of them), but for now, I just obeyed to the warning.

As the problematic transmute are about lifetime, particularly for mutable reference writes, you may be interested in https://doc.rust-lang.org/src/std/io/impls.rs.html#362-399 or https://github.com/tokio-rs/bytes/blob/fa1daac3ae1dcb07dffe3a41a041dffd6edf177b/src/buf/buf_mut.rs#L1493. I didn't try to modify this unsafe code myself in this PR.

Mallets commented 3 weeks ago

I'm honestly worried about having so much transmute in the code (I've replaced a few of them), but for now, I just obeyed to the warning.

As the problematic transmute are about lifetime, particularly for mutable reference writes, you may be interested in https://doc.rust-lang.org/src/std/io/impls.rs.html#362-399 or https://github.com/tokio-rs/bytes/blob/fa1daac3ae1dcb07dffe3a41a041dffd6edf177b/src/buf/buf_mut.rs#L1493. I didn't try to modify this unsafe code myself in this PR.

Interesting, it is definitely worth a try.