Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(book): Correct type parameter naming convention to pascal case #79

Merged
merged 2 commits into from
Jun 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions book/src/04_traits/05_trait_bounds.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ We can do better using **generics**.\
Generics allow us to write code that works with a **type parameter** instead of a concrete type:

```rust
fn print_if_even<T>(n: T)
fn print_if_even<T>(n: T)
where
T: IsEven + Debug
{
Expand Down Expand Up @@ -125,7 +125,7 @@ body is present.
All the examples above used a **`where` clause** to specify trait bounds:

```rust
fn print_if_even<T>(n: T)
fn print_if_even<T>(n: T)
where
T: IsEven + Debug
// ^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -160,7 +160,7 @@ fn print_if_even<Number: IsEven + Debug>(n: Number) {
It is actually **desirable** to use meaningful names when there are multiple type parameters at play or when the name
`T` doesn't convey enough information about the type's role in the function.
Maximize clarity and readability when naming type parameters, just as you would with variables or function parameters.
Follow Rust's conventions though: use camel case for type parameter names.
Follow Rust's conventions though: use pascal case for type parameter names.
LukeMathWalker marked this conversation as resolved.
Show resolved Hide resolved

## The function signature is king

Expand Down