rust-lang / rust-lang/rust

Extra spaces in the format_into documentation

Open
#161,436 5 comments 0 reactions 1 assignee View on GitHub

@im-lunex is already working on this.

Since Aug 21, 2026.

A-docs E-easy T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Location (URL)

https://doc.rust-lang.org/stable/core/primitive.usize.html#method.format_into

Summary
use core::fmt::NumBuffer;

let n = 0usize;
let mut buf = NumBuffer::new();
assert_eq!(n.format_into(&mut buf), "0");

let n1 = 32usize;
assert_eq!(n1.format_into(&mut buf), "32");

let n2 = usize :: MAX;  // Extra spaces
assert_eq!(n2.format_into(&mut buf), usize :: MAX.to_string());  // Extra spaces

Possible patch:

-#[doc = concat!("let n2 = ", stringify!($Signed::MAX), ";")]
-#[doc = concat!("assert_eq!(n2.format_into(&mut buf), ", stringify!($Signed::MAX), ".to_string());")]
+#[doc = concat!("let n2 = ", stringify!($Signed), "::MAX;")]
+#[doc = concat!("assert_eq!(n2.format_into(&mut buf), ", stringify!($Signed), "::MAX.to_string());")]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.