-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed clippy warnings #5
Conversation
@@ -22,7 +20,7 @@ pub trait FixedInt: Sized + Copy { | |||
v | |||
} | |||
/// Helper: Decode the value from the Vec. | |||
fn decode_fixed_vec(v: &Vec<u8>) -> Self { | |||
fn decode_fixed_vec(v: &[u8]) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please undo this and similar changes, as the Vec is intended (for backwards compatibility at least, I acknowledge the limited usefulness.
If you disagree very strongly, just delete the whole method, as decode_fixed
already does this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need backwards compatibility, I can revert this and mark this function as deprecated. Any thoughts?
}; | ||
} | ||
|
||
fn encode_fixed(self, dst: &mut [u8]) { | ||
assert_eq!(dst.len(), Self::REQUIRED_SPACE); | ||
let encoded = unsafe { transmute::<&$t, &[u8; $sz]>(&self) }; | ||
let encoded = unsafe { &*(&self as *const $t as *const [u8; $sz]) }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this to fix a clippy warning or your personal taste? Because I like the old way better :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just to fix clippy warning, I don't have a personal taste for this. We can keep it the old way if it suits you better. :-)
No description provided.