-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Fix documentation of from_ne_bytes and from_le_bytes #58998
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @bluss (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">()); | ||
*input = rest; | ||
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap()) | ||
", stringify!($SelfT), "::from_le_bytes(int_bytes.try_into().unwrap()) |
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.
I see there's a le_bytes
in
Should this test be using that?
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.
Updated the PR.
r? @scottmcm |
📌 Commit 63f60b0 has been approved by |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit 63f60b0 has been approved by |
@xTibor: if you don't have time to do that, or just don't want to I could pick it up. :-) |
@bartsmykla: Feel free to pick it up. Honestly, I just wanted to push a small fix to the docs examples that has been bothering me while writing retro data crunchers, not refactoring this whole thing. |
Perfect! :-) |
Fix documentation of from_ne_bytes and from_le_bytes Copypasta mistake, the documentation of `from_ne_bytes` and `from_le_bytes` used the big-endian variant in the example snippets.
Fix documentation of from_ne_bytes and from_le_bytes Copypasta mistake, the documentation of `from_ne_bytes` and `from_le_bytes` used the big-endian variant in the example snippets.
Fix documentation of from_ne_bytes and from_le_bytes Copypasta mistake, the documentation of `from_ne_bytes` and `from_le_bytes` used the big-endian variant in the example snippets.
Rollup of 16 pull requests Successful merges: - #58829 (librustc_interface: Update scoped-tls to 1.0) - #58876 (Parse lifetimes that start with a number and give specific error) - #58908 (Update rand version) - #58998 (Fix documentation of from_ne_bytes and from_le_bytes) - #59056 (Use lifetime contravariance to elide more lifetimes in core+alloc+std) - #59057 (Standardize `Range*` documentation) - #59080 (Fix incorrect links in librustc_codegen_llvm documentation) - #59083 (Fix #54822 and associated faulty tests) - #59093 (Remove precompute_in_scope_traits_hashes) - #59101 (Reduces Code Repetitions like `!n >> amt`) - #59121 (impl FromIterator for Result: Use assert_eq! instead of assert!) - #59124 (Replace assert with assert_eq) - #59129 (Visit impl Trait for dead_code lint) - #59130 (Note that NonNull does not launder shared references for mutation) - #59132 (ignore higher-ranked object bound conditions created by WF) - #59138 (Simplify Iterator::{min, max}) Failed merges: r? @ghost
Copypasta mistake, the documentation of
from_ne_bytes
andfrom_le_bytes
used the big-endian variant in the example snippets.