File tree 1 file changed +5
-9
lines changed 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -5,19 +5,15 @@ must have `UpperCamelCase` names, or the compiler will raise a warning. The
5
5
exception to this rule are the primitive types: ` usize ` , ` f32 ` , etc.
6
6
7
7
``` rust,editable
8
- // `NanoSecond` is a new name for `u64`.
8
+ // `NanoSecond`, `Inch`, and `U64` are new names for `u64`.
9
9
type NanoSecond = u64;
10
10
type Inch = u64;
11
-
12
- // Use an attribute to silence warning.
13
- #[allow(non_camel_case_types)]
14
- type u64_t = u64;
15
- // TODO ^ Try removing the attribute
11
+ type U64 = u64;
16
12
17
13
fn main() {
18
- // `NanoSecond` = `Inch` = `u64_t ` = `u64`.
19
- let nanoseconds: NanoSecond = 5 as u64_t ;
20
- let inches: Inch = 2 as u64_t ;
14
+ // `NanoSecond` = `Inch` = `U64 ` = `u64`.
15
+ let nanoseconds: NanoSecond = 5 as U64 ;
16
+ let inches: Inch = 2 as U64 ;
21
17
22
18
// Note that type aliases *don't* provide any extra type safety, because
23
19
// aliases are *not* new types
You can’t perform that action at this time.
0 commit comments