Reputation: 1778
I have been struggling define aliases for primitive types.
#[allow(non_camel_case_types)]
pub type i32x2 = [ i32 ; 2 ];
pub type f64x2 = [ f64 ; 2 ];
pub type f64x4 = [ f64 ; 4 ];
Is there a way to disable a warning for a whole file?
Upvotes: 6
Views: 1253
Reputation: 1664
Yes, there is a way. And you were pretty close to it 😃
#![allow(non_camel_case_types)] // at the top of the file
It can also be used at the top of your lib.rs
file to disable those warnings for all the files in your library.
The way you would do it if it is not just for prototyping:
#[allow(non_camel_case_types)]
mod types {
pub type i32x2 = [i32; 2];
pub type f64x2 = [f64; 2];
pub type f64x4 = [f64; 4];
}
See also:
Upvotes: 5