diff options
| author | bors <bors@rust-lang.org> | 2023-06-13 13:07:43 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-06-13 13:07:43 +0000 |
| commit | 2ca8d358e55bc56755b597ea96b557232ef8bc86 (patch) | |
| tree | 96e6dc40e7208d5fbdc581aa7ab2106b9c84fa53 /tests/ui/for-loop-while | |
| parent | 4bd4e2ea824f4f458cae8917047ebb6b88853fe6 (diff) | |
| parent | edafbaffb26d8be00f6dd8ad0dbaa57f1caf1610 (diff) | |
| download | rust-2ca8d358e55bc56755b597ea96b557232ef8bc86.tar.gz rust-2ca8d358e55bc56755b597ea96b557232ef8bc86.zip | |
Auto merge of #112549 - jieyouxu:fix-tests-for-unit-bindings, r=Nilstrieb
Adjust UI tests for `unit_bindings` lint - Explicitly annotate `let x: () = expr;` where `x` has unit type, or remove the unit binding to leave only `expr;` instead. - Use `let () = init;` or `let pat = ();` where appropriate. - Fix disjoint-capture-in-same-closure test which wasn't actually testing a closure: `tests/ui/closures/2229_closure_analysis/run_pass/disjoint-capture-in-same-closure.rs`. Note that unfortunately there's *a lot* of UI tests, there are a couple of places where I may have left something like `let (): ()` (this is not needed but is left over from an ealier version of the lint) which is bad style. This PR is to help with the `unit_bindings` lint at #112380.
Diffstat (limited to 'tests/ui/for-loop-while')
| -rw-r--r-- | tests/ui/for-loop-while/loop-break-value.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/ui/for-loop-while/loop-break-value.rs b/tests/ui/for-loop-while/loop-break-value.rs index d7209fc4de8..65207fb7fb5 100644 --- a/tests/ui/for-loop-while/loop-break-value.rs +++ b/tests/ui/for-loop-while/loop-break-value.rs @@ -64,7 +64,7 @@ pub fn main() { }; assert_eq!(trait_unified_3, ["Yes"]); - let regular_break = loop { + let regular_break: () = loop { if true { break; } else { @@ -73,7 +73,7 @@ pub fn main() { }; assert_eq!(regular_break, ()); - let regular_break_2 = loop { + let regular_break_2: () = loop { if true { break Default::default(); } else { @@ -82,7 +82,7 @@ pub fn main() { }; assert_eq!(regular_break_2, ()); - let regular_break_3 = loop { + let regular_break_3: () = loop { break if true { Default::default() } else { @@ -91,13 +91,13 @@ pub fn main() { }; assert_eq!(regular_break_3, ()); - let regular_break_4 = loop { + let regular_break_4: () = loop { break (); break; }; assert_eq!(regular_break_4, ()); - let regular_break_5 = loop { + let regular_break_5: () = loop { break; break (); }; |
