How can I #[allow(non_snake_case)] for a number of variables?

I have a bunch of parameters in my code, say:

        let r_NC: f64 = 1.32;
        let r_CO: f64 = 1.24;
        let r_CCa: f64 = 1.53;
        let r_CaN: f64 = 1.47;
        let a_NCO: f64 = 125.0_f64.to_radians();
        let a_NCC: f64 = 114.0_f64.to_radians();
        let a_CaNC: f64 = 123.0_f64.to_radians();

How can I switch off the non_snake_case warning for that part of my code? Using #[allow(non_snake_case)] for every line looks quite silly...

You can apply that attribute to your function.

1 Like

Try like this

#[allow(non_snake_case)]
#[allow(unused_variables)]
fn main() {
    let r_NC: f64 = 1.32;
    let r_CO: f64 = 1.24;
    let r_CCa: f64 = 1.53;
    let r_CaN: f64 = 1.47;
    let a_NCO: f64 = 125.0_f64.to_radians();
    let a_NCC: f64 = 114.0_f64.to_radians();
    let a_CaNC: f64 = 123.0_f64.to_radians();
}