From 7d891f223f8e69211eb4dc5e2ef0487ce6eaffb7 Mon Sep 17 00:00:00 2001 From: Archer Date: Mon, 9 Jun 2025 19:21:06 +0200 Subject: [PATCH] Align pattern destructuring with rest of doc Previously, `patterns.destructure.placeholder` referred to the `_` in a destructuring pattern as "placeholder" and `..` as "wildcard". This directly contradicted the definition of struct patterns and tuple (struct) patterns, which (indirectly) define `_` as a wildcard pattern and `..` as a structure pattern et cetera (for structs, enums, and union values) or rest pattern (for tuples, tuple structs, slices, and arrays). Update the paragraph to use "wildcard pattern", "et cetera", and "rest pattern" instead. Moreover, add links to their respective sections/statements. Finally, update the rule name to `r[patterns.destructure.wildcard]`. --- src/patterns.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/patterns.md b/src/patterns.md index 60cfb21c4..6a902a674 100644 --- a/src/patterns.md +++ b/src/patterns.md @@ -92,8 +92,8 @@ Patterns can be used to *destructure* [structs], [enums], and [tuples]. Destructuring breaks up a value into its component pieces. The syntax used is almost the same as when creating such values. -r[patterns.destructure.placeholder] -In a pattern whose [scrutinee] expression has a `struct`, `enum` or `tuple` type, a placeholder (`_`) stands in for a *single* data field, whereas a wildcard `..` stands in for *all* the remaining fields of a particular variant. +r[patterns.destructure.wildcard] +In a pattern whose [scrutinee] expression has a `struct`, `enum` or `tuple` type, a [wildcard pattern](#wildcard-pattern) (`_`) stands in for a *single* data field, whereas an [et cetera](#grammar-StructPatternEtCetera) or [rest pattern](#rest-patterns) (`..`) stands in for *all* the remaining fields of a particular variant. r[patterns.destructure.named-field-shorthand] When destructuring a data structure with named (but not numbered) fields, it is allowed to write `fieldname` as a shorthand for `fieldname: fieldname`.