Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Fixed clippy warnings #5

wants to merge 1 commit into from

Conversation

devashishdxt
Copy link
Contributor

No description provided.

@@ -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 {
Copy link
Owner

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.

Copy link
Contributor Author

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]) };
Copy link
Owner

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 :-)

Copy link
Contributor Author

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. :-)

dermesser added a commit that referenced this pull request Feb 22, 2020
@dermesser dermesser closed this Feb 23, 2020
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