From 4df47a09a42620f018bdaed733fdbc4049a65e78 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 2 Dec 2024 17:37:03 -0800 Subject: [PATCH] Add test of closure precedence with return type --- tests/ui-fulldeps/pprust-parenthesis-insertion.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/ui-fulldeps/pprust-parenthesis-insertion.rs b/tests/ui-fulldeps/pprust-parenthesis-insertion.rs index f535db06879f..6535367927ef 100644 --- a/tests/ui-fulldeps/pprust-parenthesis-insertion.rs +++ b/tests/ui-fulldeps/pprust-parenthesis-insertion.rs @@ -73,6 +73,9 @@ static EXPRS: &[&str] = &[ // Closures and jumps have equal precedence. "|| return break 2", "return break || 2", + // Closures with a return type have especially high precedence. + "(|| -> T { x }) + 1", // FIXME: no parenthesis needed. + "(|| { x }) + 1", // These mean different things. "if let _ = true && false {}", "if let _ = (true && false) {}",