diff options
| author | klensy <klensy@users.noreply.github.com> | 2021-05-23 14:48:16 +0300 |
|---|---|---|
| committer | klensy <klensy@users.noreply.github.com> | 2021-05-23 14:48:16 +0300 |
| commit | 7c0db6f0f178334ca6e1fdfdfed25fb89daf568b (patch) | |
| tree | e83d1db3918e02b6b4b491456e1050506a33cc2e | |
| parent | 6e92fb409816c65cd0a78a1fbcc71e2fbabdf50a (diff) | |
| download | rust-7c0db6f0f178334ca6e1fdfdfed25fb89daf568b.tar.gz rust-7c0db6f0f178334ca6e1fdfdfed25fb89daf568b.zip | |
fix pad_integral example
| -rw-r--r-- | library/core/src/fmt/mod.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index afef790ca64..02ac4fb8006 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -1245,12 +1245,13 @@ impl<'a> Formatter<'a> { /// // We need to remove "-" from the number output. /// let tmp = self.nb.abs().to_string(); /// - /// formatter.pad_integral(self.nb > 0, "Foo ", &tmp) + /// formatter.pad_integral(self.nb >= 0, "Foo ", &tmp) /// } /// } /// /// assert_eq!(&format!("{}", Foo::new(2)), "2"); /// assert_eq!(&format!("{}", Foo::new(-1)), "-1"); + /// assert_eq!(&format!("{}", Foo::new(0)), "0"); /// assert_eq!(&format!("{:#}", Foo::new(-1)), "-Foo 1"); /// assert_eq!(&format!("{:0>#8}", Foo::new(-1)), "00-Foo 1"); /// ``` |
