fix: generated test fixture

This commit is contained in:
Luiz Carlos Mourão Paes de Carvalho 2021-03-12 08:53:57 -03:00
parent 7a9230acdf
commit e505752442
2 changed files with 25 additions and 2 deletions

View file

@ -10,7 +10,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists};
//
// Converts an Iterator::for_each function into a for loop.
//
// ```rust
// ```
// fn main() {
// let vec = vec![(1, 2), (2, 3), (3, 4)];
// x.iter().for_each(|(x, y)| {
@ -19,7 +19,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists};
// }
// ```
// ->
// ```rust
// ```
// fn main() {
// let vec = vec![(1, 2), (2, 3), (3, 4)];
// for (x, y) in x.iter() {

View file

@ -205,6 +205,29 @@ const _: i32 = 0b1010;
)
}
#[test]
fn doctest_convert_iter_for_each_to_for() {
check_doc_test(
"convert_iter_for_each_to_for",
r#####"
fn main() {
let vec = vec![(1, 2), (2, 3), (3, 4)];
x.iter().for_each(|(x, y)| {
println!("x: {}, y: {}", x, y);
});
}
"#####,
r#####"
fn main() {
let vec = vec![(1, 2), (2, 3), (3, 4)];
for (x, y) in x.iter() {
println!("x: {}, y: {}", x, y);
}
}
"#####,
)
}
#[test]
fn doctest_convert_to_guarded_return() {
check_doc_test(