mirror of https://github.com/rust-lang/book
Change CamelCase to UpperCamelCase
Brings the terminology in line with the rest of the project, see <https://github.com/rust-lang/rfcs/pull/2389>. Connects to #2194.
This commit is contained in:
parent
4404cbcc35
commit
f2a78f64b6
|
@ -546,6 +546,7 @@ unsafety
|
||||||
unsized
|
unsized
|
||||||
unsynchronized
|
unsynchronized
|
||||||
Unyank
|
Unyank
|
||||||
|
UpperCamelCase
|
||||||
URIs
|
URIs
|
||||||
UsefulType
|
UsefulType
|
||||||
username
|
username
|
||||||
|
|
|
@ -33,9 +33,9 @@ the duplication by introducing a generic type parameter in a single function.
|
||||||
To parameterize the types in a new single function, we need to name the type
|
To parameterize the types in a new single function, we need to name the type
|
||||||
parameter, just as we do for the value parameters to a function. You can use
|
parameter, just as we do for the value parameters to a function. You can use
|
||||||
any identifier as a type parameter name. But we’ll use `T` because, by
|
any identifier as a type parameter name. But we’ll use `T` because, by
|
||||||
convention, type parameter names in Rust are short, often just a letter, and Rust’s
|
convention, type parameter names in Rust are short, often just a letter, and
|
||||||
type-naming convention is CamelCase. Short for “type,” `T` is the default
|
Rust’s type-naming convention is UpperCamelCase. Short for “type,” `T` is the
|
||||||
choice of most Rust programmers.
|
default choice of most Rust programmers.
|
||||||
|
|
||||||
When we use a parameter in the body of the function, we have to declare the
|
When we use a parameter in the body of the function, we have to declare the
|
||||||
parameter name in the signature so the compiler knows what that name means.
|
parameter name in the signature so the compiler knows what that name means.
|
||||||
|
|
Loading…
Reference in New Issue