Allow formatting example/gen_block_iterate.rs
This commit is contained in:
parent
a2f29439bf
commit
242558058a
3 changed files with 12 additions and 9 deletions
|
@ -6,16 +6,25 @@
|
||||||
#![feature(gen_blocks)]
|
#![feature(gen_blocks)]
|
||||||
|
|
||||||
fn foo() -> impl Iterator<Item = u32> {
|
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> {
|
fn moved() -> impl Iterator<Item = u32> {
|
||||||
let mut x = "foo".to_string();
|
let mut x = "foo".to_string();
|
||||||
gen move {
|
gen move {
|
||||||
yield 42;
|
yield 42;
|
||||||
if x == "foo" { return }
|
if x == "foo" {
|
||||||
|
return;
|
||||||
|
}
|
||||||
x.clear();
|
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();
|
let mut iter = moved();
|
||||||
assert_eq!(iter.next(), Some(42));
|
assert_eq!(iter.next(), Some(42));
|
||||||
assert_eq!(iter.next(), None);
|
assert_eq!(iter.next(), None);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
ignore = [
|
|
||||||
"example/gen_block_iterate.rs", # uses edition 2024
|
|
||||||
]
|
|
||||||
|
|
||||||
# Matches rustfmt.toml of rustc
|
# Matches rustfmt.toml of rustc
|
||||||
style_edition = "2024"
|
style_edition = "2024"
|
||||||
use_small_heuristics = "Max"
|
use_small_heuristics = "Max"
|
||||||
|
|
|
@ -49,7 +49,6 @@ ignore = [
|
||||||
|
|
||||||
# These are ignored by a standard cargo fmt run.
|
# These are ignored by a standard cargo fmt run.
|
||||||
"compiler/rustc_codegen_cranelift/scripts",
|
"compiler/rustc_codegen_cranelift/scripts",
|
||||||
"compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs", # uses edition 2024
|
|
||||||
"compiler/rustc_codegen_gcc/tests",
|
"compiler/rustc_codegen_gcc/tests",
|
||||||
# Code automatically generated and included.
|
# Code automatically generated and included.
|
||||||
"compiler/rustc_codegen_gcc/src/intrinsic/archs.rs",
|
"compiler/rustc_codegen_gcc/src/intrinsic/archs.rs",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue