diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2025-04-01 14:13:53 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2025-04-01 14:49:15 +0000 |
| commit | 242558058a0aa3d5b64d911f45a07f27930016e7 (patch) | |
| tree | 92c57f242630ca5442d35cd0a69a8d4dcada7797 /compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs | |
| parent | a2f29439bf0fbf9823cf99cee61254875379e2c4 (diff) | |
| download | rust-242558058a0aa3d5b64d911f45a07f27930016e7.tar.gz rust-242558058a0aa3d5b64d911f45a07f27930016e7.zip | |
Allow formatting example/gen_block_iterate.rs
Diffstat (limited to 'compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs')
| -rw-r--r-- | compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs b/compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs index 25bfe542d22..de9a3d550ec 100644 --- a/compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs +++ b/compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs @@ -6,16 +6,25 @@ #![feature(gen_blocks)] fn foo() -> impl Iterator<Item = u32> { - gen { yield 42; for x in 3..6 { yield x } } + gen { + yield 42; + for x in 3..6 { + yield x + } + } } fn moved() -> impl Iterator<Item = u32> { let mut x = "foo".to_string(); gen move { yield 42; - if x == "foo" { return } + if x == "foo" { + return; + } x.clear(); - for x in 3..6 { yield x } + for x in 3..6 { + yield x + } } } @@ -32,5 +41,4 @@ fn main() { let mut iter = moved(); assert_eq!(iter.next(), Some(42)); assert_eq!(iter.next(), None); - } |
