Skip to content
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

Fix pattern examples #528

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/patterns.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ A :t:`refutable constant` is a :t:`constant` of a :t:`refutable type`.
.. rubric:: Examples

:dp:`fls_sgu9bnp7xajv`
``x`` is an :t:`irrefutable pattern` because it always matches ``42``.
``x`` is an :t:`irrefutable pattern` because it matches all possible values of type ``i32``.

.. code-block:: rust

let x = 42;

:dp:`fls_cl1g4fxfa020`
``y`` is a :t:`refutable pattern` because it does not match ``value`` when
``core::option::Option::Some(y)`` is a :t:`refutable pattern` because it does not match ``value`` when
``value`` denotes :std:`core::option::Option::None`.

.. code-block:: rust
Expand Down Expand Up @@ -708,7 +708,7 @@ A slice pattern in the context of a match expression.

.. syntax::

match v {
match v.as_slice() {
[a, b, c] => (),
_ => ()
}
Expand Down
Loading