Skip to content

Commit e99a153

Browse files
felixpherryFelix PherryLukeMathWalker
authored
fix(book): Correct type parameter naming convention to pascal case (mainmatter#79)
* fix(book): Correct type parameter naming convention to pascal case * Update book/src/04_traits/05_trait_bounds.md --------- Co-authored-by: Felix Pherry <[email protected]> Co-authored-by: Luca Palmieri <[email protected]>
1 parent ffb2f08 commit e99a153

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

book/src/04_traits/05_trait_bounds.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ We can do better using **generics**.\
5858
Generics allow us to write code that works with a **type parameter** instead of a concrete type:
5959

6060
```rust
61-
fn print_if_even<T>(n: T)
61+
fn print_if_even<T>(n: T)
6262
where
6363
T: IsEven + Debug
6464
{
@@ -125,7 +125,7 @@ body is present.
125125
All the examples above used a **`where` clause** to specify trait bounds:
126126

127127
```rust
128-
fn print_if_even<T>(n: T)
128+
fn print_if_even<T>(n: T)
129129
where
130130
T: IsEven + Debug
131131
// ^^^^^^^^^^^^^^^^^
@@ -160,7 +160,7 @@ fn print_if_even<Number: IsEven + Debug>(n: Number) {
160160
It is actually **desirable** to use meaningful names when there are multiple type parameters at play or when the name
161161
`T` doesn't convey enough information about the type's role in the function.
162162
Maximize clarity and readability when naming type parameters, just as you would with variables or function parameters.
163-
Follow Rust's conventions though: use camel case for type parameter names.
163+
Follow Rust's conventions, though: use [upper camel case for type parameter names](https://rust-lang.github.io/api-guidelines/naming.html#casing-conforms-to-rfc-430-c-case).
164164

165165
## The function signature is king
166166

0 commit comments

Comments
 (0)