Skip to content

Commit 5224ae0

Browse files
committed
Prettier
1 parent c7482a2 commit 5224ae0

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

content/lessons/06_closures_iterators/index.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ For completeness, there is a (concrete) type of function pointers:
4242

4343
- `fn` - functions, closures with no captures.
4444

45-
Those traits and the `fn` type form a hierarchy: `fn` `Fn``FnMut``FnOnce`
45+
Those traits and the `fn` type form a hierarchy: `fn``Fn``FnMut``FnOnce`
4646

4747
<!--> $$ fn \subseteq Fn \subseteq FnMut \subseteq FnOnce $$ -->
4848

@@ -56,7 +56,6 @@ The following code sample shows how one can use closures as `dyn Trait` objects,
5656

5757
{{ include_code_sample(path="lessons/06_closures_iterators/closures_fun.rs", language="rust") }}
5858

59-
6059
## Examples
6160

6261
We'll go through the examples from [Rust by Example](https://doc.rust-lang.org/rust-by-example/fn/closures.html).
@@ -67,7 +66,7 @@ More examples will be seen when working with iterators.
6766
In Rust, there is no hierarchy of types for collections (because there is no inheritance in general).
6867
Instead, what makes a collection is that it can be iterated over.
6968

70-
A usual way in Rust to perform an iteration over something, be it a range of values or items in a collection, is creating a (lazy) iterator over it and transforming it using _iterator adaptors_. For example, if `T: Iterator`, then `T::map()` creates a `Map<T>` adaptor. Once a final iterator is created, it has to be actually activated, which is most commonly done by:
69+
A usual way in Rust to perform an iteration over something, be it a range of values or items in a collection, is creating a (lazy) iterator over it and transforming it using _iterator adaptors_. For example, if `T: Iterator`, then `T::map()` creates a `Map<T>` adaptor. Once a final iterator is created, it has to be actually activated (iterated over), which is most commonly done by:
7170

7271
- exhausting it with the `for` loop,
7372
- manually iterating over it using `next()` calls,

content/lessons/06_closures_iterators/iterator_exhaustion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn main() {
2525
*s = s.replace("b", "aba");
2626
}
2727

28-
// This is equivalent code.
28+
// This code is equivalent to the `for` above.
2929
// `for` is usually more idiomatic, but `for_each` is sometimes cleaner and sometimes faster.
3030
strings
3131
.iter_mut()

0 commit comments

Comments
 (0)