chore: Fix 1.88.0 clippy lints#4872
Merged
tobias-wilfert merged 2 commits intomasterfrom Jun 27, 2025
Merged
Conversation
Dav1dde
reviewed
Jun 27, 2025
relay-cabi/src/core.rs
Outdated
| #[relay_ffi::catch_unwind] | ||
| pub unsafe extern "C" fn relay_uuid_is_nil(uuid: *const RelayUuid) -> bool { | ||
| if let Ok(uuid) = Uuid::from_slice(unsafe { &(*uuid).data[..] }) { | ||
| if let Ok(uuid) = Uuid::from_slice(unsafe { &(&(*uuid).data)[..] }) { |
Member
There was a problem hiding this comment.
This looks like the wrong fix, as the lint suggets:
--> relay-cabi/src/core.rs:138:50
|
138 | if let Ok(uuid) = Uuid::from_slice(unsafe { &(*uuid).data[..] }) {
| ^^^^^^^^^^^^^^^^
|
= note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
= note: `#[warn(dangerous_implicit_autorefs)]` on by default
help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
|
138 | if let Ok(uuid) = Uuid::from_slice(unsafe { &(&(*uuid).data)[..] }) {
| ++ +
Can we not avoid the reference?
Contributor
There was a problem hiding this comment.
I think replacing the from_slice calls with
Uuid::from_bytes(unsafe { (*uuid).data })should do the trick. Also simplifies things a bit because from_bytes is not fallible (it takes the correct length by definition).
Member
Author
There was a problem hiding this comment.
Oh nice, was trying to use u128 but that turns out does not have a stable ABI (today I learned)
dcd043e to
03fd8ea
Compare
Dav1dde
approved these changes
Jun 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses:
#skip-changelog