Allow formatting example/gen_block_iterate.rs

This commit is contained in:
bjorn3 2025-04-01 14:13:53 +00:00
parent a2f29439bf
commit 242558058a
3 changed files with 12 additions and 9 deletions

View file

@ -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);
}

View file

@ -1,7 +1,3 @@
ignore = [
"example/gen_block_iterate.rs", # uses edition 2024
]
# Matches rustfmt.toml of rustc
style_edition = "2024"
use_small_heuristics = "Max"

View file

@ -49,7 +49,6 @@ ignore = [
# These are ignored by a standard cargo fmt run.
"compiler/rustc_codegen_cranelift/scripts",
"compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs", # uses edition 2024
"compiler/rustc_codegen_gcc/tests",
# Code automatically generated and included.
"compiler/rustc_codegen_gcc/src/intrinsic/archs.rs",