From ead8262c71a97d35d85511d015227689b60fdf5a Mon Sep 17 00:00:00 2001 From: Radonirinaunimi Date: Tue, 1 Oct 2024 13:12:19 +0200 Subject: [PATCH] Revert "fix all warnings from clippy (non-deps related)" This reverts commit ced2f8e8b4c45f92a498d9656a28a8e8d4e20cd1. --- docs/cli-tutorial.md | 2 +- pineappl/src/bin.rs | 2 -- pineappl/src/convolutions.rs | 1 - pineappl/src/empty_subgrid.rs | 1 - pineappl/src/fk_table.rs | 1 - pineappl/src/grid.rs | 17 +---------------- pineappl/src/import_only_subgrid.rs | 3 --- pineappl/src/lagrange_subgrid.rs | 5 ----- pineappl/src/pids.rs | 1 - pineappl/src/sparse_array3.rs | 2 -- pineappl/tests/drell_yan_lo.rs | 2 -- pineappl_capi/src/lib.rs | 8 -------- pineappl_cli/src/convolve.rs | 3 +-- pineappl_cli/src/diff.rs | 1 - pineappl_cli/src/evolve.rs | 1 - pineappl_cli/src/export.rs | 2 -- pineappl_cli/src/import.rs | 2 -- pineappl_cli/src/merge.rs | 3 +-- pineappl_cli/src/plot.rs | 1 - pineappl_cli/src/write.rs | 2 -- pineappl_cli/tests/convolve.rs | 2 +- pineappl_cli/tests/import.rs | 2 -- pineappl_cli/tests/main.rs | 2 +- pineappl_cli/tests/merge.rs | 2 +- 24 files changed, 7 insertions(+), 61 deletions(-) diff --git a/docs/cli-tutorial.md b/docs/cli-tutorial.md index 7797180e5..f148248e8 100644 --- a/docs/cli-tutorial.md +++ b/docs/cli-tutorial.md @@ -82,7 +82,7 @@ used already, run Depending on the version of PineAPPL this will show output similar to the following: - Convolves a PineAPPL grid with a PDF set + Convolutes a PineAPPL grid with a PDF set Usage: pineappl convolve [OPTIONS] ... diff --git a/pineappl/src/bin.rs b/pineappl/src/bin.rs index 8803ec4d3..3d45a597e 100644 --- a/pineappl/src/bin.rs +++ b/pineappl/src/bin.rs @@ -108,7 +108,6 @@ pub enum ParseBinRemapperError { }, } -#[allow(clippy::assigning_clones)] impl FromStr for BinRemapper { type Err = ParseBinRemapperError; @@ -788,7 +787,6 @@ impl BinLimits { } } -#[allow(clippy::float_cmp)] #[cfg(test)] mod test { use super::*; diff --git a/pineappl/src/convolutions.rs b/pineappl/src/convolutions.rs index 7dc8c06f8..ea726c440 100644 --- a/pineappl/src/convolutions.rs +++ b/pineappl/src/convolutions.rs @@ -294,7 +294,6 @@ impl<'a> LumiCache<'a> { } /// Set the grids. - #[allow(clippy::float_cmp)] pub fn set_grids( &mut self, mu2_grid: &[Mu2], diff --git a/pineappl/src/empty_subgrid.rs b/pineappl/src/empty_subgrid.rs index d52df04d6..79640e655 100644 --- a/pineappl/src/empty_subgrid.rs +++ b/pineappl/src/empty_subgrid.rs @@ -75,7 +75,6 @@ impl Subgrid for EmptySubgridV1 { } } -#[allow(clippy::float_cmp)] #[cfg(test)] mod tests { use super::*; diff --git a/pineappl/src/fk_table.rs b/pineappl/src/fk_table.rs index 9f9152e40..bf040da46 100644 --- a/pineappl/src/fk_table.rs +++ b/pineappl/src/fk_table.rs @@ -296,7 +296,6 @@ impl FkTable { } } -#[allow(clippy::float_cmp)] impl TryFrom for FkTable { type Error = TryFromGridError; diff --git a/pineappl/src/grid.rs b/pineappl/src/grid.rs index 78dc22c04..19698d228 100644 --- a/pineappl/src/grid.rs +++ b/pineappl/src/grid.rs @@ -213,7 +213,6 @@ bitflags! { /// Main data structure of `PineAPPL`. This structure contains a `Subgrid` for each `LumiEntry`, /// bin, and coupling order it was created with. -#[allow(clippy::unsafe_derive_deserialize)] #[derive(Clone, Deserialize, Serialize)] pub struct Grid { subgrids: Array3, @@ -258,7 +257,6 @@ impl Grid { /// # Errors /// /// If `subgrid_type` is none of the values listed above, an error is returned. - #[allow(clippy::needless_pass_by_value)] pub fn with_subgrid_type( channels: Vec, orders: Vec, @@ -335,7 +333,6 @@ impl Grid { /// # Panics /// /// TODO - #[allow(clippy::float_cmp)] pub fn convolve( &self, lumi_cache: &mut LumiCache, @@ -417,7 +414,7 @@ impl Grid { bins } - /// Convolves a single subgrid `(order, bin, channel)` with the PDFs strong coupling given by + /// Convolutes a single subgrid `(order, bin, channel)` with the PDFs strong coupling given by /// `xfx1`, `xfx2` and `alphas`. The convolution result is fully differentially, such that the /// axes of the result correspond to the values given by the subgrid `q2`, `x1` and `x2` grid /// values. @@ -844,7 +841,6 @@ impl Grid { } /// Set the convolution type for this grid for the corresponding `index`. - #[allow(clippy::needless_pass_by_value)] pub fn set_convolution(&mut self, index: usize, convolution: Convolution) { // remove outdated metadata self.key_values_mut() @@ -1395,11 +1391,6 @@ impl Grid { /// Returns a [`GridError::EvolutionFailure`] if either the `operator` or its `info` is /// incompatible with this `Grid`. Returns a [`GridError::Other`] if the iterator from `slices` /// return an error. - /// - /// # Panics - /// - /// This function will panic if the dimension of the operators do not match the operator - /// information. pub fn evolve_with_slice_iter<'a, E: Into>( &self, slices: impl IntoIterator), E>>, @@ -1522,11 +1513,6 @@ impl Grid { /// Returns a [`GridError::EvolutionFailure`] if either the `operator` or its `info` is /// incompatible with this `Grid`. Returns a [`GridError::Other`] if the iterator from `slices` /// return an error. - /// - /// # Panics - /// - /// This function will panic if the dimension of the operators do not match the operator - /// information. pub fn evolve_with_slice_iter2<'a, E: Into>( &self, slices_a: impl IntoIterator), E>>, @@ -1675,7 +1661,6 @@ impl Grid { /// Deletes bins with the corresponding `bin_indices`. Repeated indices and indices larger or /// equal the bin length are ignored. - #[allow(clippy::range_plus_one)] pub fn delete_bins(&mut self, bin_indices: &[usize]) { let mut bin_indices: Vec<_> = bin_indices .iter() diff --git a/pineappl/src/import_only_subgrid.rs b/pineappl/src/import_only_subgrid.rs index 180d5512a..04624c09a 100644 --- a/pineappl/src/import_only_subgrid.rs +++ b/pineappl/src/import_only_subgrid.rs @@ -77,7 +77,6 @@ impl Subgrid for ImportOnlySubgridV1 { self.array.is_empty() } - #[allow(clippy::float_cmp)] fn merge(&mut self, other: &mut SubgridEnum, transpose: bool) { if let SubgridEnum::ImportOnlySubgridV1(other_grid) = other { if self.array.is_empty() && !transpose { @@ -244,7 +243,6 @@ impl Subgrid for ImportOnlySubgridV2 { self.array.is_empty() } - #[allow(clippy::float_cmp)] fn merge(&mut self, other: &mut SubgridEnum, transpose: bool) { if let SubgridEnum::ImportOnlySubgridV2(other_grid) = other { if self.array.is_empty() && !transpose { @@ -435,7 +433,6 @@ impl From<&SubgridEnum> for ImportOnlySubgridV2 { } } -#[allow(clippy::float_cmp)] #[cfg(test)] mod tests { use super::*; diff --git a/pineappl/src/lagrange_subgrid.rs b/pineappl/src/lagrange_subgrid.rs index 04674d84c..8888d394c 100644 --- a/pineappl/src/lagrange_subgrid.rs +++ b/pineappl/src/lagrange_subgrid.rs @@ -13,12 +13,10 @@ use std::borrow::Cow; use std::iter; use std::mem; -#[allow(clippy::suboptimal_flops)] fn weightfun(x: f64) -> f64 { (x.sqrt() / (1.0 - 0.99 * x)).powi(3) } -#[allow(clippy::suboptimal_flops)] fn fx(y: f64) -> f64 { let mut yp = y; @@ -414,7 +412,6 @@ pub struct LagrangeSubgridV2 { pub(crate) static_q2: f64, } -#[allow(clippy::float_cmp)] impl LagrangeSubgridV2 { /// Constructor. #[must_use] @@ -496,7 +493,6 @@ impl LagrangeSubgridV2 { } } -#[allow(clippy::float_cmp)] impl Subgrid for LagrangeSubgridV2 { fn convolve( &self, @@ -1059,7 +1055,6 @@ impl From<&LagrangeSubgridV1> for LagrangeSparseSubgridV1 { } } -#[allow(clippy::float_cmp)] #[cfg(test)] mod tests { use super::*; diff --git a/pineappl/src/pids.rs b/pineappl/src/pids.rs index 1fb3d982f..5d130d06b 100644 --- a/pineappl/src/pids.rs +++ b/pineappl/src/pids.rs @@ -383,7 +383,6 @@ pub const fn charge_conjugate_pdg_pid(pid: i32) -> i32 { /// Given `tuples` represting a linear combination of PDG MC IDs, return a PID for the `evol` /// basis. The order of each tuple in `tuples` is not relevant. This function inverts /// [`evol_to_pdg_mc_ids`]. If the inversion is not possible, `None` is returned. -#[allow(clippy::float_cmp)] #[must_use] pub fn pdg_mc_ids_to_evol(tuples: &[(i32, f64)]) -> Option { let mut tuples = tuples.to_vec(); diff --git a/pineappl/src/sparse_array3.rs b/pineappl/src/sparse_array3.rs index ff57e6016..1debae7e8 100644 --- a/pineappl/src/sparse_array3.rs +++ b/pineappl/src/sparse_array3.rs @@ -349,7 +349,6 @@ impl SparseArray3 { } /// Return an iterator over the elements, including zero elements. - #[allow(clippy::iter_without_into_iter)] pub fn iter_mut(&mut self) -> IterMut<'_, T> { self.entries.iter_mut() } @@ -421,7 +420,6 @@ impl SparseArray3 { } } -#[allow(clippy::float_cmp)] #[cfg(test)] mod tests { use super::*; diff --git a/pineappl/tests/drell_yan_lo.rs b/pineappl/tests/drell_yan_lo.rs index 76b318d32..21dad5710 100644 --- a/pineappl/tests/drell_yan_lo.rs +++ b/pineappl/tests/drell_yan_lo.rs @@ -25,7 +25,6 @@ fn int_photo(s: f64, t: f64, u: f64) -> f64 { } // Eq. (2.12) - quark-antiquark contribution to DY lepton pair production -#[allow(clippy::suboptimal_flops)] fn int_quark(s: f64, t: f64, u: f64, qq: f64, i3_wq: f64) -> f64 { let alphagf: f64 = 1.0 / 132.30818655547878; let mw = 80.35198454966643; @@ -78,7 +77,6 @@ struct Psp2to2 { jacobian: f64, } -#[allow(clippy::suboptimal_flops)] fn hadronic_pspgen(rng: &mut impl Rng, mmin: f64, mmax: f64) -> Psp2to2 { let smin = mmin * mmin; let smax = mmax * mmax; diff --git a/pineappl_capi/src/lib.rs b/pineappl_capi/src/lib.rs index 09569e6db..38c45d2d7 100644 --- a/pineappl_capi/src/lib.rs +++ b/pineappl_capi/src/lib.rs @@ -292,10 +292,6 @@ pub unsafe extern "C" fn pineappl_grid_clone(grid: *const Grid) -> Box { } /// Wrapper for [`pineappl_grid_convolve_with_one`]. -/// -/// # Safety -/// -/// This function should not be used anymore. Use `pineappl_grid_convolve_with_one` instead. #[deprecated( since = "0.8.0", note = "please use `pineappl_grid_convolve_with_one` instead" @@ -330,10 +326,6 @@ pub unsafe extern "C" fn pineappl_grid_convolute_with_one( } /// Wrapper for [`pineappl_grid_convolve_with_two`]. -/// -/// # Safety -/// -/// This function should not be used anymore. Use `pineappl_grid_convolve_with_two` instead. #[deprecated( since = "0.8.0", note = "please use `pineappl_grid_convolve_with_two` instead" diff --git a/pineappl_cli/src/convolve.rs b/pineappl_cli/src/convolve.rs index 559620f1f..5377abc54 100644 --- a/pineappl_cli/src/convolve.rs +++ b/pineappl_cli/src/convolve.rs @@ -7,8 +7,7 @@ use std::ops::RangeInclusive; use std::path::PathBuf; use std::process::ExitCode; -/// Convolves a PineAPPL grid with a PDF set. -#[allow(clippy::doc_markdown)] +/// Convolutes a PineAPPL grid with a PDF set. #[derive(Parser)] #[command(alias = "convolute")] pub struct Opts { diff --git a/pineappl_cli/src/diff.rs b/pineappl_cli/src/diff.rs index b7da462ca..4e6e48585 100644 --- a/pineappl_cli/src/diff.rs +++ b/pineappl_cli/src/diff.rs @@ -57,7 +57,6 @@ pub struct Opts { digits_rel: usize, } -#[allow(clippy::float_cmp)] impl Subcommand for Opts { fn run(&self, cfg: &GlobalConfiguration) -> Result { let grid1 = helpers::read_grid(&self.input1)?; diff --git a/pineappl_cli/src/evolve.rs b/pineappl_cli/src/evolve.rs index 850af51ef..23c476378 100644 --- a/pineappl_cli/src/evolve.rs +++ b/pineappl_cli/src/evolve.rs @@ -560,7 +560,6 @@ pub struct Opts { use_old_evolve: bool, } -#[allow(clippy::float_cmp)] impl Subcommand for Opts { fn run(&self, cfg: &GlobalConfiguration) -> Result { use prettytable::row; diff --git a/pineappl_cli/src/export.rs b/pineappl_cli/src/export.rs index 316d54906..e4ee819d5 100644 --- a/pineappl_cli/src/export.rs +++ b/pineappl_cli/src/export.rs @@ -65,7 +65,6 @@ fn convert_into_grid( } /// Converts PineAPPL grids to APPLgrid files. -#[allow(clippy::doc_markdown)] #[derive(Parser)] pub struct Opts { /// Path to the input grid. @@ -98,7 +97,6 @@ pub struct Opts { digits_rel: usize, } -#[allow(clippy::float_cmp)] impl Subcommand for Opts { fn run(&self, cfg: &GlobalConfiguration) -> Result { use prettytable::{cell, row}; diff --git a/pineappl_cli/src/import.rs b/pineappl_cli/src/import.rs index 7eb1d534a..e349640bf 100644 --- a/pineappl_cli/src/import.rs +++ b/pineappl_cli/src/import.rs @@ -205,7 +205,6 @@ const fn fnlo_mu_possible_values() -> Vec<&'static str> { } /// Converts APPLgrid/fastNLO/FastKernel files to PineAPPL grids. -#[allow(clippy::doc_markdown)] #[derive(Parser)] pub struct Opts { /// Path to the input grid. @@ -252,7 +251,6 @@ pub struct Opts { dis_pid: i32, } -#[allow(clippy::float_cmp)] impl Subcommand for Opts { fn run(&self, cfg: &GlobalConfiguration) -> Result { use prettytable::{cell, row}; diff --git a/pineappl_cli/src/merge.rs b/pineappl_cli/src/merge.rs index 58cd16201..30d5bd69a 100644 --- a/pineappl_cli/src/merge.rs +++ b/pineappl_cli/src/merge.rs @@ -6,10 +6,9 @@ use std::path::PathBuf; use std::process::ExitCode; /// Merges one or more PineAPPL grids together. -#[allow(clippy::doc_markdown)] #[derive(Parser)] pub struct Opts { - /// Path of the merged `PineAPPL` file. + /// Path of the merged PineAPPL file. #[arg(value_hint = ValueHint::FilePath)] output: PathBuf, /// Path(s) of the files that should be merged. diff --git a/pineappl_cli/src/plot.rs b/pineappl_cli/src/plot.rs index cf42efbfe..d7b27ff9e 100644 --- a/pineappl_cli/src/plot.rs +++ b/pineappl_cli/src/plot.rs @@ -160,7 +160,6 @@ fn format_metadata(metadata: &[(&String, &String)]) -> String { .join("\n") } -#[allow(clippy::float_cmp)] impl Subcommand for Opts { fn run(&self, cfg: &GlobalConfiguration) -> Result { ThreadPoolBuilder::new() diff --git a/pineappl_cli/src/write.rs b/pineappl_cli/src/write.rs index 74267881a..f01358d6c 100644 --- a/pineappl_cli/src/write.rs +++ b/pineappl_cli/src/write.rs @@ -16,7 +16,6 @@ use std::path::PathBuf; use std::process::ExitCode; /// Write a grid modified by various operations. -#[allow(clippy::doc_markdown)] #[derive(Parser)] pub struct Opts { /// Path to the input grid. @@ -495,7 +494,6 @@ impl Args for MoreArgs { } } -#[allow(clippy::range_plus_one)] impl Subcommand for Opts { fn run(&self, _: &GlobalConfiguration) -> Result { let mut grid = helpers::read_grid(&self.input)?; diff --git a/pineappl_cli/tests/convolve.rs b/pineappl_cli/tests/convolve.rs index 1d52984ad..dbf0d107b 100644 --- a/pineappl_cli/tests/convolve.rs +++ b/pineappl_cli/tests/convolve.rs @@ -1,7 +1,7 @@ use assert_cmd::Command; use predicates::str; -const HELP_STR: &str = "Convolves a PineAPPL grid with a PDF set +const HELP_STR: &str = "Convolutes a PineAPPL grid with a PDF set Usage: pineappl convolve [OPTIONS] ... diff --git a/pineappl_cli/tests/import.rs b/pineappl_cli/tests/import.rs index bd2f6da66..fca7b9e10 100644 --- a/pineappl_cli/tests/import.rs +++ b/pineappl_cli/tests/import.rs @@ -656,7 +656,6 @@ fn import_flex_grid_15() { .stdout(predicates::str::ends_with(IMPORT_FLEX_GRID_15_STR)); } -#[allow(clippy::float_cmp)] #[test] #[cfg(feature = "fktable")] fn import_dis_fktable() { @@ -832,7 +831,6 @@ fn import_dis_fktable() { ); } -#[allow(clippy::float_cmp)] #[test] #[cfg(feature = "fktable")] fn import_hadronic_fktable() { diff --git a/pineappl_cli/tests/main.rs b/pineappl_cli/tests/main.rs index 01b01972e..0ba04dce5 100644 --- a/pineappl_cli/tests/main.rs +++ b/pineappl_cli/tests/main.rs @@ -7,7 +7,7 @@ Usage: pineappl [OPTIONS] Commands: analyze Perform various analyses with grids channels Shows the contribution for each partonic channel - convolve Convolves a PineAPPL grid with a PDF set + convolve Convolutes a PineAPPL grid with a PDF set diff Compares the numerical content of two grids with each other evolve Evolve a grid with an evolution kernel operator to an FK table export Converts PineAPPL grids to APPLgrid files diff --git a/pineappl_cli/tests/merge.rs b/pineappl_cli/tests/merge.rs index 370a3db39..ae57dc5aa 100644 --- a/pineappl_cli/tests/merge.rs +++ b/pineappl_cli/tests/merge.rs @@ -6,7 +6,7 @@ const HELP_STR: &str = "Merges one or more PineAPPL grids together Usage: pineappl merge ... Arguments: - Path of the merged `PineAPPL` file + Path of the merged PineAPPL file ... Path(s) of the files that should be merged Options: