-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 examples #53618
Add missing fmt examples #53618
Conversation
src/libcore/fmt/mod.rs
Outdated
/// impl fmt::Display for Foo { | ||
/// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | ||
/// // We need to remove "-" from the number output. | ||
/// let tmp = if self.nb < 0 { self.nb * -1 } else { self.nb }.to_string(); |
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.
This could probably be expressed as self.nb.abs().to_string()
.
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.
This would be better actually.
46e456a
to
2cc2e01
Compare
Updated. |
@bors r+ (travis is actually green if you click through, github never updated with the result) |
📌 Commit 2cc2e01 has been approved by |
@bors: rollup |
…tMisdreavus Add missing fmt examples r? @QuietMisdreavus
Rollup of 16 pull requests Successful merges: - #53311 (Window Mutex: Document that we properly initialize the SRWLock) - #53503 (Discourage overuse of mem::forget) - #53545 (Fix #50865: ICE on impl-trait returning functions reaching private items) - #53559 (add macro check for lint) - #53562 (Lament the invincibility of the Turbofish) - #53563 (use String::new() instead of String::from(""), "".to_string(), "".to_owned() or "".into()) - #53592 (docs: minor stylistic changes to str/string docs) - #53594 (Update RELEASES.md to include clippy-preview) - #53600 (Fix a grammatical mistake in "expected generic arguments" errors) - #53614 (update nomicon and book) - #53617 (tidy: Stop requiring a license header) - #53618 (Add missing fmt examples) - #53636 (Prefer `.nth(n)` over `.skip(n).next()`.) - #53644 (Use SmallVec for SmallCStr) - #53664 (Remove unnecessary closure in rustc_mir/build/mod.rs) - #53666 (Added rustc_codegen_llvm to compiler documentation.)
r? @QuietMisdreavus