-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add missing fmt structs examples #58538
Conversation
9b0f70f
to
c01656d
Compare
src/libcore/fmt/builders.rs
Outdated
/// struct Foo(Vec<(String, i32)>); | ||
/// | ||
/// impl fmt::Debug for Foo { | ||
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { |
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.
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | |
/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { |
src/libcore/fmt/builders.rs
Outdated
/// fmt.debug_struct("Bar") | ||
/// .field("bar", &self.bar) | ||
/// .field("baz", &self.baz) | ||
/// .finish() // You need to call it in order to "finish" the |
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.
/// .finish() // You need to call it in order to "finish" the | |
/// .finish() // You need to call it to "finish" the |
src/libcore/fmt/builders.rs
Outdated
/// } | ||
/// | ||
/// impl fmt::Debug for Bar { | ||
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { |
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.
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | |
/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { |
src/libcore/fmt/builders.rs
Outdated
/// } | ||
/// | ||
/// impl fmt::Debug for Bar { | ||
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { |
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.
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | |
/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { |
src/libcore/fmt/builders.rs
Outdated
/// struct Foo(i32, String); | ||
/// | ||
/// impl fmt::Debug for Foo { | ||
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { |
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.
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | |
/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { |
src/libcore/fmt/builders.rs
Outdated
/// struct Foo(Vec<i32>, Vec<u32>); | ||
/// | ||
/// impl fmt::Debug for Foo { | ||
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { |
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.
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | |
/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { |
src/libcore/fmt/builders.rs
Outdated
/// struct Foo(Vec<i32>); | ||
/// | ||
/// impl fmt::Debug for Foo { | ||
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { |
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.
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | |
/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { |
src/libcore/fmt/builders.rs
Outdated
/// struct Foo(Vec<(String, i32)>); | ||
/// | ||
/// impl fmt::Debug for Foo { | ||
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { |
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.
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | |
/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { |
src/libcore/fmt/builders.rs
Outdated
/// struct Foo(Vec<(String, i32)>); | ||
/// | ||
/// impl fmt::Debug for Foo { | ||
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { |
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.
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | |
/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { |
src/libcore/fmt/builders.rs
Outdated
/// impl fmt::Debug for Foo { | ||
/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ||
/// fmt.debug_map() | ||
/// .entry(&"whole", &self.0) // We add the "whole" entry |
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.
/// .entry(&"whole", &self.0) // We add the "whole" entry | |
/// .entry(&"whole", &self.0) // We add the "whole" entry. |
r? @Centril r=me with nits addressed. |
c01656d
to
31ee20d
Compare
@bors: r=Centril rollup |
📌 Commit 31ee20d has been approved by |
Add missing fmt structs examples r? @rust-lang/docs
Rollup of 24 pull requests Successful merges: - #56470 (Modify doctest's auto-`fn main()` to allow `Result`s) - #58044 (Make overflowing and wrapping negation const) - #58303 (Improve stability tags display) - #58336 (Fix search results interactions) - #58384 (Fix tables display) - #58392 (Use less explicit shifting in std::net::ip) - #58409 (rustdoc: respect alternate flag when formatting impl trait) - #58456 (Remove no longer accurate diagnostic code about NLL) - #58528 (Don't use an allocation for ItemId in StmtKind) - #58530 (Monomorphize less code in fs::{read|write}) - #58534 (Mention capping forbid lints) - #58536 (Remove UB in pointer tests) - #58538 (Add missing fmt structs examples) - #58539 (Add alias methods to PathBuf for underlying OsString (#58234)) - #58544 (Fix doc for rustc "-g" flag) - #58545 (Add regression test for a specialization-related ICE (#39448)) - #58546 (librustc_codegen_llvm => 2018) - #58551 (Explain a panic in test case net::tcp::tests::double_bind) - #58553 (Use more impl header lifetime elision) - #58562 (Fix style nits) - #58565 (Fix typo in std::future::Future docs) - #58568 (Fix a transposition in driver.rs.) - #58569 (Reduce Some Code Repetitions like `(n << amt) >> amt`) - #58576 (Stabilize iter::successors and iter::from_fn)
Rollup of 24 pull requests Successful merges: - #56470 (Modify doctest's auto-`fn main()` to allow `Result`s) - #58044 (Make overflowing and wrapping negation const) - #58303 (Improve stability tags display) - #58336 (Fix search results interactions) - #58384 (Fix tables display) - #58392 (Use less explicit shifting in std::net::ip) - #58409 (rustdoc: respect alternate flag when formatting impl trait) - #58456 (Remove no longer accurate diagnostic code about NLL) - #58528 (Don't use an allocation for ItemId in StmtKind) - #58530 (Monomorphize less code in fs::{read|write}) - #58534 (Mention capping forbid lints) - #58536 (Remove UB in pointer tests) - #58538 (Add missing fmt structs examples) - #58539 (Add alias methods to PathBuf for underlying OsString (#58234)) - #58544 (Fix doc for rustc "-g" flag) - #58545 (Add regression test for a specialization-related ICE (#39448)) - #58546 (librustc_codegen_llvm => 2018) - #58551 (Explain a panic in test case net::tcp::tests::double_bind) - #58553 (Use more impl header lifetime elision) - #58562 (Fix style nits) - #58565 (Fix typo in std::future::Future docs) - #58568 (Fix a transposition in driver.rs.) - #58569 (Reduce Some Code Repetitions like `(n << amt) >> amt`) - #58576 (Stabilize iter::successors and iter::from_fn)
r? @rust-lang/docs