]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #4064 - mikerite:fix-771, r=matthiaskrgr
authorbors <bors@rust-lang.org>
Tue, 7 May 2019 04:35:42 +0000 (04:35 +0000)
committerbors <bors@rust-lang.org>
Tue, 7 May 2019 04:35:42 +0000 (04:35 +0000)
Add test for #771.

Closes #771

<!--
Thank you for making Clippy better!

We're collecting our changelog from pull request descriptions.
If your PR only updates to the latest nightly, you can leave the
`changelog` entry as `none`. Otherwise, please write a short comment
explaining your change.

If your PR fixes an issue, you can add "fixes #issue_number" into this
PR description. This way the issue will be automatically closed when
your PR is merged.

If you added a new lint, here's a checklist for things that will be
checked during review or continuous integration.

- [ ] Followed [lint naming conventions][lint_naming]
- [ ] Added passing UI tests (including committed `.stderr` file)
- [ ] `cargo test` passes locally
- [ ] Executed `util/dev update_lints`
- [ ] Added lint documentation
- [ ] Run `cargo fmt`

Note that you can skip the above if you are just opening a WIP PR in
order to get feedback.

Delete this line and everything above before opening your PR -->

changelog: none

tests/ui/while_loop.rs

index 005ce141d27a3f580e9183bb5110cf597afd545e..a8506553e92c860284bfdadfd3ac924903e8f8c9 100644 (file)
@@ -238,3 +238,18 @@ fn issue3670() {
         let _ = elem.or_else(|| *iter.next()?);
     }
 }
+
+fn issue771() {
+    let mut a = 100;
+    let b = Some(true);
+    loop {
+        if a > 10 {
+            break;
+        }
+
+        match b {
+            Some(_) => a = 0,
+            None => break,
+        }
+    }
+}