about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-07-18 14:49:19 +0200
committerGitHub <noreply@github.com>2025-07-18 14:49:19 +0200
commit744ca5959a665e23e7e7b30ecf81d17c22223cc2 (patch)
treef132db45b4f127d84940426ae41956bbe386cf81
parent0820cf8c6e179277cd161da2fc3ad22b807d9742 (diff)
parentf5485e55644cea6395fb2196b915dee1b48f6427 (diff)
downloadrust-744ca5959a665e23e7e7b30ecf81d17c22223cc2.tar.gz
rust-744ca5959a665e23e7e7b30ecf81d17c22223cc2.zip
Rollup merge of #143909 - nik-rev:patch-1, r=jhpratt
docs(alloc::fmt): Make type optional, instead of matching empty string

Think this is clearer.

Noticed as I was implementing [`tree-sitter-rust-format-args`](https://github.com/nik-rev/tree-sitter-rust-format-args), and attempting to match the empty string results in an error.
-rw-r--r--library/alloc/src/fmt.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/alloc/src/fmt.rs b/library/alloc/src/fmt.rs
index 30f42050ac8..d0ba9c39886 100644
--- a/library/alloc/src/fmt.rs
+++ b/library/alloc/src/fmt.rs
@@ -348,13 +348,13 @@
 //! format := '{' [ argument ] [ ':' format_spec ] [ ws ] * '}'
 //! argument := integer | identifier
 //!
-//! format_spec := [[fill]align][sign]['#']['0'][width]['.' precision]type
+//! format_spec := [[fill]align][sign]['#']['0'][width]['.' precision][type]
 //! fill := character
 //! align := '<' | '^' | '>'
 //! sign := '+' | '-'
 //! width := count
 //! precision := count | '*'
-//! type := '' | '?' | 'x?' | 'X?' | identifier
+//! type := '?' | 'x?' | 'X?' | identifier
 //! count := parameter | integer
 //! parameter := argument '$'
 //! ```