From e9b495e72901d1678873e655f5f239a6938641f0 Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Sat, 8 Dec 2018 13:21:41 -0800 Subject: [PATCH] Silence some clippy warnings on generated code and large preformatted data. --- sub_crates/halton/src/lib.rs | 4 ++++ sub_crates/sobol/src/lib.rs | 2 +- sub_crates/sobol/src/matrices.rs | 2 ++ sub_crates/spectra_xyz/src/generate_spectra_tables.py | 5 +++-- sub_crates/spectra_xyz/src/spectra_tables.rs | 1 + 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sub_crates/halton/src/lib.rs b/sub_crates/halton/src/lib.rs index 6c8d801..fb271d5 100644 --- a/sub_crates/halton/src/lib.rs +++ b/sub_crates/halton/src/lib.rs @@ -1,4 +1,8 @@ #![allow(dead_code)] +#![allow(clippy::cast_lossless)] +#![allow(clippy::excessive_precision)] +#![allow(clippy::unreadable_literal)] +#![allow(clippy::needless_return)] // Include the file generated by the build.rs script include!(concat!(env!("OUT_DIR"), "/halton.rs")); diff --git a/sub_crates/sobol/src/lib.rs b/sub_crates/sobol/src/lib.rs index 47b5a8b..fee2c6d 100644 --- a/sub_crates/sobol/src/lib.rs +++ b/sub_crates/sobol/src/lib.rs @@ -45,7 +45,7 @@ pub fn sample_with_scramble(dimension: u32, mut index: u32, scramble: u32) -> f3 i += 1; } - return result as f32 * (1.0 / (1u64 << 32) as f32); + result as f32 * (1.0 / (1u64 << 32) as f32) } #[inline] diff --git a/sub_crates/sobol/src/matrices.rs b/sub_crates/sobol/src/matrices.rs index d7ccf38..f3f90ae 100644 --- a/sub_crates/sobol/src/matrices.rs +++ b/sub_crates/sobol/src/matrices.rs @@ -28,6 +28,8 @@ // The tabulated direction numbers are available here: // http://web.maths.unsw.edu.au/~fkuo/sobol/new-joe-kuo-6.21201 +#![allow(clippy::unreadable_literal)] + pub const NUM_DIMENSIONS: usize = 1024; pub const SIZE: usize = 52; diff --git a/sub_crates/spectra_xyz/src/generate_spectra_tables.py b/sub_crates/spectra_xyz/src/generate_spectra_tables.py index 27698c6..3be86cf 100755 --- a/sub_crates/spectra_xyz/src/generate_spectra_tables.py +++ b/sub_crates/spectra_xyz/src/generate_spectra_tables.py @@ -779,8 +779,9 @@ def write_output(data_points, grid, grid_res, filename): f.write('// This file is auto-generated by generate_spectra_tables.py\n') f.write('#![allow(dead_code)]\n') - f.write('#![cfg_attr(rustfmt, rustfmt_skip)]') - f.write('\n\n') + f.write('#![cfg_attr(rustfmt, rustfmt_skip)]\n') + f.write('#![allow(clippy::unreadable_literal)]\n') + f.write('\n') f.write('/// This is 1 over the integral over either CMF.\n') f.write('/// Spectra can be mapped so that xyz=(1,1,1) is converted to constant 1 by\n') f.write('/// dividing by this value. This is important for valid reflectances.\n') diff --git a/sub_crates/spectra_xyz/src/spectra_tables.rs b/sub_crates/spectra_xyz/src/spectra_tables.rs index fe5862c..5782921 100644 --- a/sub_crates/spectra_xyz/src/spectra_tables.rs +++ b/sub_crates/spectra_xyz/src/spectra_tables.rs @@ -1,6 +1,7 @@ // This file is auto-generated by generate_spectra_tables.py #![allow(dead_code)] #![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(clippy::unreadable_literal)] /// This is 1 over the integral over either CMF. /// Spectra can be mapped so that xyz=(1,1,1) is converted to constant 1 by