Skip to content

Commit b1605fe

Browse files
committed
Book: fixed syntax coloring
1 parent 382ab92 commit b1605fe

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/doc/book/closures.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ to our closure when we pass it to `call_with_one`, so we use `&||`.
322322
A quick note about closures that use explicit lifetimes. Sometimes you might have a closure
323323
that takes a reference like so:
324324

325-
```
325+
```rust
326326
fn call_with_ref<F>(some_closure:F) -> i32
327327
where F: Fn(&i32) -> i32 {
328328

@@ -334,8 +334,8 @@ fn call_with_ref<F>(some_closure:F) -> i32
334334
Normally you can specify the lifetime of the parameter to our closure. We
335335
could annotate it on the function declaration:
336336

337-
```ignore
338-
fn call_with_ref<'a, F>(some_closure:F) -> i32
337+
```rust,ignore
338+
fn call_with_ref<'a, F>(some_closure:F) -> i32
339339
where F: Fn(&'a 32) -> i32 {
340340
```
341341

@@ -353,11 +353,11 @@ fn call_with_ref<F>(some_closure:F) -> i32
353353
where F: for<'a> Fn(&'a 32) -> i32 {
354354
```
355355

356-
This lets the Rust compiler find the minimum lifetime to invoke our closure and
356+
This lets the Rust compiler find the minimum lifetime to invoke our closure and
357357
satisfy the borrow checker's rules. Our function then compiles and excutes as we
358358
expect.
359359

360-
```
360+
```rust
361361
fn call_with_ref<F>(some_closure:F) -> i32
362362
where F: for<'a> Fn(&'a i32) -> i32 {
363363

0 commit comments

Comments
 (0)