diff options
| author | bors <bors@rust-lang.org> | 2019-12-06 19:14:51 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-12-06 19:14:51 +0000 |
| commit | ae1b871cca56613b1af1a5121dd24ac810ff4b89 (patch) | |
| tree | 74e64f30306a0f66e9a98cc1929802f77906c2ff /src/libsyntax_ext | |
| parent | 9630dbbc3caca60f2482e6eae8904aa6bda54f93 (diff) | |
| parent | f1db60ca9513c1693974f0b27c55d21a39f438b0 (diff) | |
| download | rust-ae1b871cca56613b1af1a5121dd24ac810ff4b89.tar.gz rust-ae1b871cca56613b1af1a5121dd24ac810ff4b89.zip | |
Auto merge of #65195 - varkor:to_option, r=Centril
Rename `bool::then_*` to `bool::to_option_*` and use where appropriate Name change following https://github.com/rust-lang/rfcs/pull/2757. Also try it out throughout the compiler in places I think makes the code more readable.
Diffstat (limited to 'src/libsyntax_ext')
| -rw-r--r-- | src/libsyntax_ext/format_foreign.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax_ext/lib.rs | 1 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/libsyntax_ext/format_foreign.rs b/src/libsyntax_ext/format_foreign.rs index 3d4f8276441..0d1d2926c85 100644 --- a/src/libsyntax_ext/format_foreign.rs +++ b/src/libsyntax_ext/format_foreign.rs @@ -95,12 +95,12 @@ pub mod printf { }; // Has a special form in Rust for numbers. - let fill = if c_zero { Some("0") } else { None }; + let fill = c_zero.then_some("0"); - let align = if c_left { Some("<") } else { None }; + let align = c_left.then_some("<"); // Rust doesn't have an equivalent to the `' '` flag. - let sign = if c_plus { Some("+") } else { None }; + let sign = c_plus.then_some("+"); // Not *quite* the same, depending on the type... let alt = c_alt; diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs index b9287d2fe70..55c7f3fa574 100644 --- a/src/libsyntax_ext/lib.rs +++ b/src/libsyntax_ext/lib.rs @@ -3,6 +3,7 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] +#![feature(bool_to_option)] #![feature(crate_visibility_modifier)] #![feature(decl_macro)] #![feature(nll)] |
