mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-16 01:38:13 +00:00
fix: generated test fixture
This commit is contained in:
parent
7a9230acdf
commit
e505752442
2 changed files with 25 additions and 2 deletions
|
@ -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() {
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue