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

API docs: Convert #40987

Merged
merged 5 commits into from
Apr 20, 2017
Merged

API docs: Convert #40987

merged 5 commits into from
Apr 20, 2017

Conversation

maccoda
Copy link
Contributor

@maccoda maccoda commented Apr 1, 2017

Clean up of the convert module documentation following points in #29349

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

@maccoda
Copy link
Contributor Author

maccoda commented Apr 1, 2017

r? @steveklabnik

@rust-highfive rust-highfive assigned steveklabnik and unassigned brson Apr 1, 2017
@frewsxcv frewsxcv added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Apr 1, 2017
@frewsxcv
Copy link
Member

frewsxcv commented Apr 1, 2017

Looks like our tidy checker wants some lines wrapped:

[00:02:33] /checkout/src/libcore/convert.rs:59: line longer than 100 chars
[00:02:33] /checkout/src/libcore/convert.rs:60: line longer than 100 chars
[00:02:33] /checkout/src/libcore/convert.rs:64: line longer than 100 chars
[00:02:33] /checkout/src/libcore/convert.rs:164: line longer than 100 chars
[00:02:33] /checkout/src/libcore/convert.rs:207: line longer than 100 chars
[00:02:33] /checkout/src/libcore/convert.rs:209: line longer than 100 chars
[00:02:33] /checkout/src/libcore/convert.rs:210: line longer than 100 chars
[00:02:33] /checkout/src/libcore/convert.rs:212: line longer than 100 chars

@maccoda
Copy link
Contributor Author

maccoda commented Apr 2, 2017

Thanks just confirmed with @steveklabnik that want standard library docs wrapped to 80 characters so that should address that 😄

@maccoda
Copy link
Contributor Author

maccoda commented Apr 2, 2017

Broken links this time will fix next chance I get.

[00:41:01] Linkcheck (x86_64-unknown-linux-gnu)
[00:41:05] std/convert/trait.AsRef.html:54: broken link - std/struct.Path.html
[00:41:05] std/convert/trait.From.html:54: broken link fragment  `#the-from-trait` pointing to `book/error-handling.html`
[00:41:06] core/convert/trait.AsRef.html:54: broken link - std/struct.Path.html
[00:41:06] core/convert/trait.From.html:54: broken link fragment  `#the-from-trait` pointing to `book/error-handling.html`

@maccoda
Copy link
Contributor Author

maccoda commented Apr 3, 2017

Closing until I get a clean build, have realized not yet ready.

@maccoda maccoda closed this Apr 3, 2017
@maccoda maccoda reopened this Apr 5, 2017
@Mark-Simulacrum Mark-Simulacrum added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 14, 2017
@carols10cents
Copy link
Member

ping @steveklabnik @frewsxcv -- looks like this is passing and ready for r now?

Copy link
Member

@steveklabnik steveklabnik left a comment

Choose a reason for hiding this comment

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

thanks for this! Looks great overall but there's some formatting details to take care of. We're good to go after they're fixed.

//! - [`From`] and [`Into`] are reflexive, which means that all types can `into()`
//! themselves and `from()` themselves
//! - [`From`] and [`Into`] are reflexive, which means that all types can
//! `into()` themselves and `from()` themselves
Copy link
Member

Choose a reason for hiding this comment

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

very minor nit: the ()s shouldn't be here. Not your fault, but while you're here, fixing them would be nice, on both into and from

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not a problem, boy scout rule applied 🤓

@@ -50,20 +50,41 @@

use str::FromStr;

/// A cheap, reference-to-reference conversion.
/// A cheap reference-to-reference conversion. Used to convert a value to a
/// reference value within generic code.
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this isn't too long for a summary line; it might get cut off on https://doc.rust-lang.org/stable/std/convert/index.html. Have you checked? if not, maybe

A cheap reference-to-reference conversion, used within generic code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have run the rustdoc build and appears to be all fine.
trait_summary

/// useful when wishing to abstract
/// over the type of reference (`&T`, `&mut T`) or allow both the referenced
/// and owned type to be treated in the same manner.
/// The key difference between the two traits is the intention:
Copy link
Member

Choose a reason for hiding this comment

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

could you put a /// above this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

/// `Borrow` is more related to the notion of taking the reference. It is
/// useful when wishing to abstract
/// over the type of reference (`&T`, `&mut T`) or allow both the referenced
/// and owned type to be treated in the same manner.
Copy link
Member

Choose a reason for hiding this comment

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

everything above here is treated as one paragraph in markdown, but are broken up strangely in the text, could you reflow this paragraph please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah don't know what happened here. Reshaped into a clearer single paragraph.

///
/// - Use `AsRef` when goal is to simply convert into a reference
/// - Use `Borrow` when goal is related to writing code that is agnostic to the
/// type of borrow and if is reference or value
Copy link
Member

Choose a reason for hiding this comment

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

i think this needs to be indented to match up with the Use above; not 100% sure though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks neater anyway so will indent them, it appeared to render fine though 😄

/// # Generic Implementations
///
/// - `AsRef` auto-dereferences if the inner type is a reference or a mutable
/// reference (e.g.: `foo.as_ref()` will work the same if `foo` has type
Copy link
Member

Choose a reason for hiding this comment

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

same here, dunno if these lines need to be indented

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indented

/// # Generic Implementations
///
/// - `AsMut` auto-dereferences if the inner type is a reference or a mutable
/// reference (e.g.: `foo.as_ref()` will work the same if `foo` has type
Copy link
Member

Choose a reason for hiding this comment

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

and here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And indented again 😄

/// erroneous situations.
/// This trait is not limited to error handling, rather the general case for
/// this trait would be in any type conversions to have an explicit definition
/// of how they are performed.
Copy link
Member

Choose a reason for hiding this comment

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

these three paragraphs will get smooshed into one by markdown; could you add /// lines between them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes my bad. Now separated.

@@ -236,15 +310,19 @@ pub trait TryFrom<T>: Sized {

// As lifts over &
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: ?Sized, U: ?Sized> AsRef<U> for &'a T where T: AsRef<U> {
impl<'a, T: ?Sized, U: ?Sized> AsRef<U> for &'a T
Copy link
Member

Choose a reason for hiding this comment

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

all the changes from here below are re-styling code and probably don't belong here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah formatter got the best of me. Reverting these changes.

@alexcrichton
Copy link
Member

Looks like this was updated, mind taking another look @steveklabnik and/or @frewsxcv?

@maccoda also when you update a PR feel free to ping it, unfortunately github doesn't send out notifications for updating a PR :(

@steveklabnik
Copy link
Member

LGTM, thanks @maccoda

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Apr 20, 2017

📌 Commit 2877a01 has been approved by steveklabnik

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Apr 20, 2017
API docs: Convert

Clean up of the convert module documentation following points in rust-lang#29349
bors added a commit that referenced this pull request Apr 20, 2017
Rollup of 2 pull requests

- Successful merges: #40812, #40987
- Failed merges:
@bors bors merged commit 2877a01 into rust-lang:master Apr 20, 2017
@maccoda
Copy link
Contributor Author

maccoda commented Apr 20, 2017

@alexcrichton thank you for that didn't know didn't send notifications will remember to do this next time!

@steveklabnik thank you, look forward to working on the next one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants