From 7f763fa6e322c617aabc8941594ad441dd783f35 Mon Sep 17 00:00:00 2001 From: Felix Pherry <182051.FELIX@klgroup.local> Date: Fri, 31 May 2024 15:18:40 +0700 Subject: [PATCH 1/2] fix(book): Correct type parameter naming convention to pascal case --- book/src/04_traits/05_trait_bounds.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/book/src/04_traits/05_trait_bounds.md b/book/src/04_traits/05_trait_bounds.md index 01bf8d3ad..701c66466 100644 --- a/book/src/04_traits/05_trait_bounds.md +++ b/book/src/04_traits/05_trait_bounds.md @@ -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(n: T) +fn print_if_even(n: T) where T: IsEven + Debug { @@ -125,7 +125,7 @@ body is present. All the examples above used a **`where` clause** to specify trait bounds: ```rust -fn print_if_even(n: T) +fn print_if_even(n: T) where T: IsEven + Debug // ^^^^^^^^^^^^^^^^^ @@ -160,7 +160,7 @@ fn print_if_even(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. ## The function signature is king From e79b940d9de3d53a52b97d940249788f2a3813b2 Mon Sep 17 00:00:00 2001 From: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com> Date: Sat, 1 Jun 2024 08:30:23 +0200 Subject: [PATCH 2/2] Update book/src/04_traits/05_trait_bounds.md --- book/src/04_traits/05_trait_bounds.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/src/04_traits/05_trait_bounds.md b/book/src/04_traits/05_trait_bounds.md index 701c66466..a3e3f7384 100644 --- a/book/src/04_traits/05_trait_bounds.md +++ b/book/src/04_traits/05_trait_bounds.md @@ -160,7 +160,7 @@ fn print_if_even(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 pascal case for type parameter names. +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). ## The function signature is king