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

Fix documentation of from_ne_bytes and from_le_bytes #58998

Merged
merged 1 commit into from
Mar 13, 2019
Merged

Fix documentation of from_ne_bytes and from_le_bytes #58998

merged 1 commit into from
Mar 13, 2019

Conversation

xTibor
Copy link
Contributor

@xTibor xTibor commented Mar 7, 2019

Copypasta mistake, the documentation of from_ne_bytes and from_le_bytes used the big-endian variant in the example snippets.

@rust-highfive
Copy link
Collaborator

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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 7, 2019
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())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the PR.

@Centril
Copy link
Contributor

Centril commented Mar 9, 2019

r? @scottmcm

@rust-highfive rust-highfive assigned scottmcm and unassigned bluss Mar 9, 2019
@scottmcm
Copy link
Member

scottmcm commented Mar 11, 2019

Because this fix is an improvement as-is,

@bors r+ rollup

That said, I think there's more that could be done here. Based on

https://github.com/rust-lang/rust/blob/0561060d23b804dde8e7e3bd85df4b1fd043747d/src/libcore/num/mod.rs#L2051-L2056

I think it'd be possible to add examples that actually run using $le_bytes and $be_bytes.

Would you be interested in opening a new PR for that, @xTibor?

@bors
Copy link
Contributor

bors commented Mar 11, 2019

📌 Commit 63f60b0 has been approved by scottmcm

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 11, 2019
@bors
Copy link
Contributor

bors commented Mar 11, 2019

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Contributor

bors commented Mar 11, 2019

📌 Commit 63f60b0 has been approved by scottmcm

@bartsmykla
Copy link

bartsmykla commented Mar 11, 2019

@xTibor: if you don't have time to do that, or just don't want to I could pick it up. :-)

@xTibor
Copy link
Contributor Author

xTibor commented Mar 11, 2019

@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.

@bartsmykla
Copy link

Perfect! :-)

kennytm added a commit to kennytm/rust that referenced this pull request Mar 11, 2019
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.
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Mar 12, 2019
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.
Centril added a commit to Centril/rust that referenced this pull request Mar 13, 2019
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.
bors added a commit that referenced this pull request Mar 13, 2019
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
@bors bors merged commit 63f60b0 into rust-lang:master Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants