-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Update docs for Debug* structs. #29355 #42836
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (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. |
src/libcore/fmt/builders.rs
Outdated
@@ -51,7 +51,33 @@ impl<'a, 'b: 'a> fmt::Write for PadAdapter<'a, 'b> { | |||
|
|||
/// A struct to help with `fmt::Debug` implementations. | |||
/// | |||
/// Constructed by the `Formatter::debug_struct` method. | |||
/// This is useful when you wish to output a formatted struct as a part of your | |||
/// `Debug::fmt` implementation. |
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.
Missing the url to the corresponding struct.
src/libcore/fmt/builders.rs
Outdated
/// This is useful when you wish to output a formatted struct as a part of your | ||
/// `Debug::fmt` implementation. | ||
/// | ||
/// This can be constructed by the `Formatter::debug_struct` method. |
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.
Missing the url to the corresponding struct.
src/libcore/fmt/builders.rs
Outdated
/// impl fmt::Debug for Foo { | ||
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ||
/// fmt.debug_struct("Foo") | ||
/// .field("bar", &self.bar) |
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.
Indent is a bit off: should be aligned to ".debug_struct".
src/libcore/fmt/builders.rs
Outdated
@@ -118,7 +144,30 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> { | |||
|
|||
/// A struct to help with `fmt::Debug` implementations. | |||
/// | |||
/// Constructed by the `Formatter::debug_tuple` method. | |||
/// This is useful when you wish to output a formatted tuple as a part of your | |||
/// `Debug::fmt` implementation. |
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.
Missing the url to the corresponding struct.
src/libcore/fmt/builders.rs
Outdated
/// This is useful when you wish to output a formatted tuple as a part of your | ||
/// `Debug::fmt` implementation. | ||
/// | ||
/// This can be constructed by the `Formatter::debug_tuple` method. |
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.
Missing the url to the corresponding method.
src/libcore/fmt/builders.rs
Outdated
@@ -230,7 +279,27 @@ impl<'a, 'b: 'a> DebugInner<'a, 'b> { | |||
|
|||
/// A struct to help with `fmt::Debug` implementations. | |||
/// | |||
/// Constructed by the `Formatter::debug_set` method. | |||
/// This is useful when you wish to output a formatted set of items as a part | |||
/// of your `Debug::fmt` implementation. |
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.
Missing the url to the corresponding struct.
src/libcore/fmt/builders.rs
Outdated
/// This is useful when you wish to output a formatted set of items as a part | ||
/// of your `Debug::fmt` implementation. | ||
/// | ||
/// This can be constructed by the `Formatter::debug_set` method. |
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.
Missing the url to the corresponding method.
src/libcore/fmt/builders.rs
Outdated
@@ -279,7 +348,27 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> { | |||
|
|||
/// A struct to help with `fmt::Debug` implementations. | |||
/// | |||
/// Constructed by the `Formatter::debug_list` method. | |||
/// This is useful when you wish to output a formatted list of items as a part | |||
/// of your `Debug::fmt` implementation. |
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.
Missing the url to the corresponding struct.
src/libcore/fmt/builders.rs
Outdated
/// This is useful when you wish to output a formatted list of items as a part | ||
/// of your `Debug::fmt` implementation. | ||
/// | ||
/// This can be constructed by the `Formatter::debug_list` method. |
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.
Missing the url to the corresponding method.
src/libcore/fmt/builders.rs
Outdated
@@ -328,7 +417,27 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> { | |||
|
|||
/// A struct to help with `fmt::Debug` implementations. | |||
/// | |||
/// Constructed by the `Formatter::debug_map` method. | |||
/// This is useful when you wish to output a formatted map as a part of your | |||
/// `Debug::fmt` implementation. |
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.
Missing the url to the corresponding struct.
src/libcore/fmt/builders.rs
Outdated
/// This is useful when you wish to output a formatted map as a part of your | ||
/// `Debug::fmt` implementation. | ||
/// | ||
/// This can be constructed by the `Formatter::debug_map` method. |
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.
Missing the url to the corresponding method.
Thanks, I've addressed all of the comments. |
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.
Just one last nit and it should be good!
src/libcore/fmt/builders.rs
Outdated
/// | ||
/// # Example | ||
/// | ||
/// ```rust |
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.
No need to add rust
tag. By default, every code block is a rust one.
src/libcore/fmt/builders.rs
Outdated
/// Constructed by the `Formatter::debug_tuple` method. | ||
/// # Example | ||
/// | ||
/// ```rust |
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.
Same.
src/libcore/fmt/builders.rs
Outdated
/// | ||
/// Constructed by the `Formatter::debug_set` method. | ||
/// ```rust |
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.
Same.
src/libcore/fmt/builders.rs
Outdated
/// | ||
/// # Example | ||
/// | ||
/// ```rust |
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.
Same.
src/libcore/fmt/builders.rs
Outdated
/// | ||
/// # Example | ||
/// | ||
/// ```rust |
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.
Same.
Also, once updated, can you squash your commits to only have one please? |
This adds docs for the Debug* structs as well as examples from the Formatter::debug_* methods, so that a user knows how to construct them. I added these examples as the builders module is not public and hence the debug_*_new() functions are not available to a user. r? @steveklabnik Review comments. Mainly adding in the links for all of the structs and functions. Remove rust tag on code blocks.
Fixed the rust tags on code blocks and squashed the commits. |
Thanks! @bors: r+ rollup |
📌 Commit d1316b4 has been approved by |
⌛ Testing commit d1316b4 with merge c354c68cf5254236dfdb68b791b44110f691dc53... |
💔 Test failed - status-travis |
I'm unsure why this docs change is failing, could the test be flakey? This is from the build logs:
|
Hum, strange... |
@bors: retry |
Update docs for Debug* structs. rust-lang#29355 This adds docs for the Debug* structs as well as examples from the Formatter::debug_* methods, so that a user knows how to construct them. I added these examples as the builders module is not public and hence the debug_*_new() functions are not available to a user. r? @steveklabnik
This adds docs for the Debug* structs as well as examples from the
Formatter::debug_* methods, so that a user knows how to construct them.
I added these examples as the builders module is not public and hence
the debug_*_new() functions are not available to a user.
r? @steveklabnik