diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-12 14:45:04 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-12 14:45:04 +0000 |
commit | c0459c53572f90fa9134192e432562af3daba5fa (patch) | |
tree | 4eaaf5618fbd742ae8212ff207bc42dc728bfd06 /docs/dev/syntax.md | |
parent | 19dd1fd4d41538de7ea386a2d0d18e27bf95f63c (diff) | |
parent | 6d35c67b6e39fae1efc48405b49d408b86666534 (diff) |
Merge #7956
7956: Add assist to convert for_each into for loops r=Veykril a=SaiintBrisson
This PR resolves #7821.
Adds an assist to that converts an `Iterator::for_each` into a for loop:
```rust
fn main() {
let vec = vec![(1, 2), (2, 3), (3, 4)];
x.iter().for_each(|(x, y)| {
println!("x: {}, y: {}", x, y);
})
}
```
becomes
```rust
fn main() {
let vec = vec![(1, 2), (2, 3), (3, 4)];
for (x, y) in x.iter() {
println!("x: {}, y: {}", x, y);
});
}
```
Co-authored-by: Luiz Carlos MourĂ£o Paes de Carvalho <[email protected]>
Co-authored-by: Luiz Carlos <[email protected]>
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'docs/dev/syntax.md')
0 files changed, 0 insertions, 0 deletions