aboutsummaryrefslogtreecommitdiff
path: root/docs/dev/style.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/dev/style.md')
-rw-r--r--docs/dev/style.md12
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/dev/style.md b/docs/dev/style.md
index e2f1b6996..0482bc190 100644
--- a/docs/dev/style.md
+++ b/docs/dev/style.md
@@ -159,7 +159,7 @@ Express function preconditions in types and force the caller to provide them (ra
159 159
160```rust 160```rust
161// GOOD 161// GOOD
162fn frbonicate(walrus: Walrus) { 162fn frobnicate(walrus: Walrus) {
163 ... 163 ...
164} 164}
165 165
@@ -374,7 +374,7 @@ Avoid making a lot of code type parametric, *especially* on the boundaries betwe
374 374
375```rust 375```rust
376// GOOD 376// GOOD
377fn frbonicate(f: impl FnMut()) { 377fn frobnicate(f: impl FnMut()) {
378 frobnicate_impl(&mut f) 378 frobnicate_impl(&mut f)
379} 379}
380fn frobnicate_impl(f: &mut dyn FnMut()) { 380fn frobnicate_impl(f: &mut dyn FnMut()) {
@@ -382,7 +382,7 @@ fn frobnicate_impl(f: &mut dyn FnMut()) {
382} 382}
383 383
384// BAD 384// BAD
385fn frbonicate(f: impl FnMut()) { 385fn frobnicate(f: impl FnMut()) {
386 // lots of code 386 // lots of code
387} 387}
388``` 388```
@@ -391,11 +391,11 @@ Avoid `AsRef` polymorphism, it pays back only for widely used libraries:
391 391
392```rust 392```rust
393// GOOD 393// GOOD
394fn frbonicate(f: &Path) { 394fn frobnicate(f: &Path) {
395} 395}
396 396
397// BAD 397// BAD
398fn frbonicate(f: impl AsRef<Path>) { 398fn frobnicate(f: impl AsRef<Path>) {
399} 399}
400``` 400```
401 401
@@ -705,7 +705,7 @@ fn foo() -> Option<Bar> {
705} 705}
706``` 706```
707 707
708**Rationale:** reduce congnitive stack usage. 708**Rationale:** reduce cognitive stack usage.
709 709
710## Comparisons 710## Comparisons
711 711