Auto merge of #13379 - alex-semenyuk:while_let_loop_fix_document, r=dswij

Fix doc for `while_let_loop`

Fix doc for `while_let_loop`

changelog: none
This commit is contained in:
bors 2024-09-11 10:03:50 +00:00
commit 78bdd4508d

View File

@ -188,22 +188,22 @@
/// The `while let` loop is usually shorter and more
/// readable.
///
/// ### Known problems
/// Sometimes the wrong binding is displayed ([#383](https://github.com/rust-lang/rust-clippy/issues/383)).
///
/// ### Example
/// ```rust,no_run
/// # let y = Some(1);
/// let y = Some(1);
/// loop {
/// let x = match y {
/// Some(x) => x,
/// None => break,
/// };
/// // .. do something with x
/// // ..
/// }
/// // is easier written as
/// ```
/// Use instead:
/// ```rust,no_run
/// let y = Some(1);
/// while let Some(x) = y {
/// // .. do something with x
/// // ..
/// };
/// ```
#[clippy::version = "pre 1.29.0"]