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

Update docs for Debug* structs. #29355 #42836

Merged
merged 1 commit into from
Jul 4, 2017
Merged

Conversation

rthomas
Copy link
Contributor

@rthomas rthomas commented Jun 22, 2017

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

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

@rthomas rthomas changed the title Add docs for Debug* structs. #29355 Update docs for Debug* structs. #29355 Jun 22, 2017
@shepmaster shepmaster added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 23, 2017
@@ -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.
Copy link
Member

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.

/// 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.
Copy link
Member

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.

/// impl fmt::Debug for Foo {
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
/// fmt.debug_struct("Foo")
/// .field("bar", &self.bar)
Copy link
Member

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

@@ -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.
Copy link
Member

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.

/// 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.
Copy link
Member

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.

@arielb1 arielb1 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 27, 2017
@@ -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.
Copy link
Member

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.

/// 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.
Copy link
Member

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.

@@ -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.
Copy link
Member

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.

/// 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.
Copy link
Member

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.

@@ -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.
Copy link
Member

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.

/// 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.
Copy link
Member

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.

@rthomas
Copy link
Contributor Author

rthomas commented Jul 1, 2017

Thanks, I've addressed all of the comments.

Copy link
Member

@GuillaumeGomez GuillaumeGomez left a 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!

///
/// # Example
///
/// ```rust
Copy link
Member

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.

/// Constructed by the `Formatter::debug_tuple` method.
/// # Example
///
/// ```rust
Copy link
Member

Choose a reason for hiding this comment

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

Same.

///
/// Constructed by the `Formatter::debug_set` method.
/// ```rust
Copy link
Member

Choose a reason for hiding this comment

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

Same.

///
/// # Example
///
/// ```rust
Copy link
Member

Choose a reason for hiding this comment

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

Same.

///
/// # Example
///
/// ```rust
Copy link
Member

Choose a reason for hiding this comment

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

Same.

@GuillaumeGomez
Copy link
Member

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.
@rthomas
Copy link
Contributor Author

rthomas commented Jul 2, 2017

Fixed the rust tags on code blocks and squashed the commits.

@GuillaumeGomez
Copy link
Member

Thanks!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Jul 3, 2017

📌 Commit d1316b4 has been approved by GuillaumeGomez

@bors
Copy link
Contributor

bors commented Jul 3, 2017

⌛ Testing commit d1316b4 with merge c354c68cf5254236dfdb68b791b44110f691dc53...

@bors
Copy link
Contributor

bors commented Jul 3, 2017

💔 Test failed - status-travis

@rthomas
Copy link
Contributor Author

rthomas commented Jul 3, 2017

I'm unsure why this docs change is failing, could the test be flakey?

This is from the build logs:

[00:59:34] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "-j" "4" "--target" "x86_64-unknown-linux-musl" "--release" "--locked" "--color" "always" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "--features" "panic-unwind jemalloc backtrace" "-p" "std:0.0.0" "-p" "rustc_lsan:0.0.0" "-p" "std_unicode:0.0.0" "-p" "collections:0.0.0" "-p" "unwind:0.0.0" "-p" "alloc:0.0.0" "-p" "rustc_tsan:0.0.0" "-p" "compiler_builtins:0.0.0" "-p" "libc:0.0.0" "-p" "panic_abort:0.0.0" "-p" "rand:0.0.0" "-p" "core:0.0.0" "-p" "rustc_msan:0.0.0" "-p" "rustc_asan:0.0.0" "-p" "alloc_system:0.0.0" "--"
[00:59:34] expected success, got: exit code: 101
[00:59:34] 
[00:59:34] 
[00:59:34] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --target x86_64-unknown-linux-musl
[00:59:34] Build completed unsuccessfully in 0:58:11

@GuillaumeGomez
Copy link
Member

Hum, strange...

@alexcrichton
Copy link
Member

@bors: retry

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Jul 4, 2017
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
bors added a commit that referenced this pull request Jul 4, 2017
Rollup of 8 pull requests

- Successful merges: #42227, #42836, #42975, #42994, #43041, #43042, #43043, #43045
- Failed merges:
@bors bors merged commit d1316b4 into rust-lang:master Jul 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants