-
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
reorder fmt docs for more clarity #65513
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
//! left-aligned. The | ||
//! defaults for numeric formatters is also a space but with right-alignment. If | ||
//! the `0` flag (see below) is specified for numerics, then the implicit fill character is | ||
//! `0`. | ||
//! | ||
//! Note that alignment may not be implemented by some types. In particular, it | ||
//! is not generally implemented for the `Debug` trait. A good way to ensure |
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.
FWIW, I do not understand this paragraph. Do they mean nested format!
?
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.
Yes, essentially -- i.e., strings definitely implement padding. So if padding is desired, a guaranteed way to obtain it is to format a string (and that string can be obtained via formatting).
I agree this paragraph is pretty confusing.
//! left-aligned. The | ||
//! defaults for numeric formatters is also a space but with right-alignment. If | ||
//! the `0` flag (see below) is specified for numerics, then the implicit fill character is | ||
//! `0`. | ||
//! | ||
//! Note that alignment may not be implemented by some types. In particular, it | ||
//! is not generally implemented for the `Debug` trait. A good way to ensure |
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.
Yes, essentially -- i.e., strings definitely implement padding. So if padding is desired, a guaranteed way to obtain it is to format a string (and that string can be obtained via formatting).
I agree this paragraph is pretty confusing.
r=me with CI passing |
I reformulated the last sentence and added an example. Does that sound right? |
@bors r+ rollup=always Indeed, that helps I think. |
📌 Commit c0b7e76 has been approved by |
reorder fmt docs for more clarity I adjusted these docs in rust-lang#65332 but wasn't happy with the result when seeing it in rustdoc. So this reorders the subsections in the "Formatting Parameters" section to be more logical (subsections that reference `width` come after the `width` subsection) and they also all have examples now.
reorder fmt docs for more clarity I adjusted these docs in rust-lang#65332 but wasn't happy with the result when seeing it in rustdoc. So this reorders the subsections in the "Formatting Parameters" section to be more logical (subsections that reference `width` come after the `width` subsection) and they also all have examples now.
reorder fmt docs for more clarity I adjusted these docs in rust-lang#65332 but wasn't happy with the result when seeing it in rustdoc. So this reorders the subsections in the "Formatting Parameters" section to be more logical (subsections that reference `width` come after the `width` subsection) and they also all have examples now.
reorder fmt docs for more clarity I adjusted these docs in rust-lang#65332 but wasn't happy with the result when seeing it in rustdoc. So this reorders the subsections in the "Formatting Parameters" section to be more logical (subsections that reference `width` come after the `width` subsection) and they also all have examples now.
reorder fmt docs for more clarity I adjusted these docs in rust-lang#65332 but wasn't happy with the result when seeing it in rustdoc. So this reorders the subsections in the "Formatting Parameters" section to be more logical (subsections that reference `width` come after the `width` subsection) and they also all have examples now.
Rollup of 17 pull requests Successful merges: - #65016 (Always inline `mem::{size_of,align_of}` in debug builds) - #65197 (Prepare `MutVisitor`s to handle interned projections) - #65201 (Disable Go and OCaml bindings when building LLVM) - #65364 (Collect occurrences of empty blocks for mismatched braces diagnostic) - #65417 (Add more coherence tests) - #65434 (Add long error explanation for E0577) - #65455 (Avoid unnecessary `TokenTree` to `TokenStream` conversions) - #65472 (Use a sharded dep node to dep node index map) - #65480 (Speed up `LexicalResolve::expansion()`) - #65496 (properly document panics in div_euclid and rem_euclid) - #65508 (add option to ping llvm ice-breakers to triagebot) - #65511 (save-analysis: Nest tables when processing impl block definitions) - #65513 (reorder fmt docs for more clarity) - #65532 (doc: make BitSet intro more short) - #65540 (show up some extra info when t!() fails) - #65549 (Fix left/right shift typo in wrapping rotate docs) - #65552 (Clarify diagnostics when using `~` as a unary op) Failed merges: - #65471 (Add long error explanation for E0578) r? @ghost
reorder fmt docs for more clarity I adjusted these docs in rust-lang#65332 but wasn't happy with the result when seeing it in rustdoc. So this reorders the subsections in the "Formatting Parameters" section to be more logical (subsections that reference `width` come after the `width` subsection) and they also all have examples now.
Rollup of 19 pull requests Successful merges: - #65016 (Always inline `mem::{size_of,align_of}` in debug builds) - #65197 (Prepare `MutVisitor`s to handle interned projections) - #65201 (Disable Go and OCaml bindings when building LLVM) - #65334 (Add long error explanation for E0575) - #65364 (Collect occurrences of empty blocks for mismatched braces diagnostic) - #65455 (Avoid unnecessary `TokenTree` to `TokenStream` conversions) - #65472 (Use a sharded dep node to dep node index map) - #65480 (Speed up `LexicalResolve::expansion()`) - #65493 (Add long error explanation for E0584) - #65496 (properly document panics in div_euclid and rem_euclid) - #65498 (Plugins deprecation: don’t suggest simply removing the attribute) - #65508 (add option to ping llvm ice-breakers to triagebot) - #65511 (save-analysis: Nest tables when processing impl block definitions) - #65513 (reorder fmt docs for more clarity) - #65532 (doc: make BitSet intro more short) - #65535 (rustc: arena-allocate the slice in `ty::GenericsPredicate`, not the whole struct.) - #65540 (show up some extra info when t!() fails) - #65549 (Fix left/right shift typo in wrapping rotate docs) - #65552 (Clarify diagnostics when using `~` as a unary op) Failed merges: - #65390 (Add long error explanation for E0576) - #65434 (Add long error explanation for E0577) - #65471 (Add long error explanation for E0578) r? @ghost
I adjusted these docs in #65332 but wasn't happy with the result when seeing it in rustdoc. So this reorders the subsections in the "Formatting Parameters" section to be more logical (subsections that reference
width
come after thewidth
subsection) and they also all have examples now.