File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Expand file tree Collapse file tree 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
55exception to this rule are the primitive types: ` usize ` , ` f32 ` , etc.
66
77``` rust,editable 
8- // `NanoSecond` is a  new name  for `u64`. 
8+ // `NanoSecond`, `Inch`, and `U64` are  new names  for `u64`. 
99type NanoSecond = u64; 
1010type 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; 
1612
1713fn 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 ; 
2117
2218    // Note that type aliases *don't* provide any extra type safety, because 
2319    // aliases are *not* new types 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments