Skip to content

Commit 7de45d7

Browse files
authored
Rollup merge of rust-lang#145233 - joshtriplett:cfg-select-expr, r=jieyouxu
cfg_select: Support unbraced expressions Tracking issue for `cfg_select`: rust-lang#115585 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. --- I'm not sure whether deciding to extend `cfg_select!` in this way is T-lang or T-libs-api. I've labeled for both, with the request that both teams don't block on each other. :)
2 parents ecfc84d + 9e39c75 commit 7de45d7

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)