Skip to content

Commit 9e39c75

Browse files
committed
cfg_select: Support unbraced expressions
When operating on expressions, `cfg_select!` can now handle expressions without braces. (It still requires braces for other things, such as items.) Expand the test coverage and documentation accordingly.
1 parent 7029f55 commit 9e39c75

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/src/macros/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,14 @@ pub macro assert_matches {
223223
/// }
224224
/// ```
225225
///
226-
/// The `cfg_select!` macro can also be used in expression position:
226+
/// The `cfg_select!` macro can also be used in expression position, with or without braces on the
227+
/// right-hand side:
227228
///
228229
/// ```
229230
/// #![feature(cfg_select)]
230231
///
231232
/// let _some_string = cfg_select! {
232-
/// unix => { "With great power comes great electricity bills" }
233+
/// unix => "With great power comes great electricity bills",
233234
/// _ => { "Behind every successful diet is an unwatched pizza" }
234235
/// };
235236
/// ```

0 commit comments

Comments
 (0)