Skip to content

Commit

Permalink
rpt 33 tweet & toot links
Browse files Browse the repository at this point in the history
  • Loading branch information
encody committed Jan 28, 2024
1 parent 88a38ec commit 15700ec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions content/blog/rust-pro-tips-collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This is a collection of Rust "pro tips" that I've collected, most of which have

## 33. Use tuple struct initializers as function pointers

<!-- [Tweet]() [Toot]() -->
[Tweet](https://twitter.com/sudo_build/status/1751597656114446377) [Toot](https://infosec.exchange/@hatchet/111833792212244273)

Tuple struct initializers can be cast to function pointers. This can help to avoid creating unnecessary lambda functions, e.g. when calling [`Iterator::map`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.map).

Expand All @@ -29,8 +29,8 @@ fn zeroes<T>(f: fn(i32, i32) -> T) -> T {
assert_eq!(zeroes(Point), Point(0, 0));
```

[Docs](https://doc.rust-lang.org/reference/expressions/struct-expr.html#tuple-struct-expression) \
[Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=7cb12bc6930a9ae03204a33eb50529ce)
[Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=7cb12bc6930a9ae03204a33eb50529ce) \
[Docs](https://doc.rust-lang.org/reference/expressions/struct-expr.html#tuple-struct-expression)

## 32. Absolute import paths

Expand Down

0 comments on commit 15700ec

Please sign in to comment.