diff --git a/docs/cli-tutorial.md b/docs/cli-tutorial.md index f148248e..7797180e 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: - Convolutes a PineAPPL grid with a PDF set + Convolves a PineAPPL grid with a PDF set Usage: pineappl convolve [OPTIONS] ... diff --git a/pineappl/src/bin.rs b/pineappl/src/bin.rs index 3d45a597..8803ec4d 100644 --- a/pineappl/src/bin.rs +++ b/pineappl/src/bin.rs @@ -108,6 +108,7 @@ pub enum ParseBinRemapperError { }, } +#[allow(clippy::assigning_clones)] impl FromStr for BinRemapper { type Err = ParseBinRemapperError; @@ -787,6 +788,7 @@ 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 ea726c44..7dc8c06f 100644 --- a/pineappl/src/convolutions.rs +++ b/pineappl/src/convolutions.rs @@ -294,6 +294,7 @@ 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 79640e65..d52df04d 100644 --- a/pineappl/src/empty_subgrid.rs +++ b/pineappl/src/empty_subgrid.rs @@ -75,6 +75,7 @@ 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 bf040da4..9f9152e4 100644 --- a/pineappl/src/fk_table.rs +++ b/pineappl/src/fk_table.rs @@ -296,6 +296,7 @@ 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 19698d22..78dc22c0 100644 --- a/pineappl/src/grid.rs +++ b/pineappl/src/grid.rs @@ -213,6 +213,7 @@ 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, @@ -257,6 +258,7 @@ 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, @@ -333,6 +335,7 @@ impl Grid { /// # Panics /// /// TODO + #[allow(clippy::float_cmp)] pub fn convolve( &self, lumi_cache: &mut LumiCache, @@ -414,7 +417,7 @@ impl Grid { bins } - /// Convolutes a single subgrid `(order, bin, channel)` with the PDFs strong coupling given by + /// Convolves 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. @@ -841,6 +844,7 @@ 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() @@ -1391,6 +1395,11 @@ 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>>, @@ -1513,6 +1522,11 @@ 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>>, @@ -1661,6 +1675,7 @@ 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 04624c09..180d5512 100644 --- a/pineappl/src/import_only_subgrid.rs +++ b/pineappl/src/import_only_subgrid.rs @@ -77,6 +77,7 @@ 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 { @@ -243,6 +244,7 @@ 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 { @@ -433,6 +435,7 @@ 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 8888d394..04674d84 100644 --- a/pineappl/src/lagrange_subgrid.rs +++ b/pineappl/src/lagrange_subgrid.rs @@ -13,10 +13,12 @@ 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; @@ -412,6 +414,7 @@ pub struct LagrangeSubgridV2 { pub(crate) static_q2: f64, } +#[allow(clippy::float_cmp)] impl LagrangeSubgridV2 { /// Constructor. #[must_use] @@ -493,6 +496,7 @@ impl LagrangeSubgridV2 { } } +#[allow(clippy::float_cmp)] impl Subgrid for LagrangeSubgridV2 { fn convolve( &self, @@ -1055,6 +1059,7 @@ 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 5d130d06..1fb3d982 100644 --- a/pineappl/src/pids.rs +++ b/pineappl/src/pids.rs @@ -383,6 +383,7 @@ 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 1debae7e..ff57e601 100644 --- a/pineappl/src/sparse_array3.rs +++ b/pineappl/src/sparse_array3.rs @@ -349,6 +349,7 @@ 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() } @@ -420,6 +421,7 @@ 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 21dad571..76b318d3 100644 --- a/pineappl/tests/drell_yan_lo.rs +++ b/pineappl/tests/drell_yan_lo.rs @@ -25,6 +25,7 @@ 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; @@ -77,6 +78,7 @@ 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 38c45d2d..09569e6d 100644 --- a/pineappl_capi/src/lib.rs +++ b/pineappl_capi/src/lib.rs @@ -292,6 +292,10 @@ 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" @@ -326,6 +330,10 @@ 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 5377abc5..559620f1 100644 --- a/pineappl_cli/src/convolve.rs +++ b/pineappl_cli/src/convolve.rs @@ -7,7 +7,8 @@ use std::ops::RangeInclusive; use std::path::PathBuf; use std::process::ExitCode; -/// Convolutes a PineAPPL grid with a PDF set. +/// Convolves a PineAPPL grid with a PDF set. +#[allow(clippy::doc_markdown)] #[derive(Parser)] #[command(alias = "convolute")] pub struct Opts { diff --git a/pineappl_cli/src/diff.rs b/pineappl_cli/src/diff.rs index 4e6e4858..b7da462c 100644 --- a/pineappl_cli/src/diff.rs +++ b/pineappl_cli/src/diff.rs @@ -57,6 +57,7 @@ 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 23c47637..850af51e 100644 --- a/pineappl_cli/src/evolve.rs +++ b/pineappl_cli/src/evolve.rs @@ -560,6 +560,7 @@ 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 e4ee819d..316d5490 100644 --- a/pineappl_cli/src/export.rs +++ b/pineappl_cli/src/export.rs @@ -65,6 +65,7 @@ fn convert_into_grid( } /// Converts PineAPPL grids to APPLgrid files. +#[allow(clippy::doc_markdown)] #[derive(Parser)] pub struct Opts { /// Path to the input grid. @@ -97,6 +98,7 @@ 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 e349640b..7eb1d534 100644 --- a/pineappl_cli/src/import.rs +++ b/pineappl_cli/src/import.rs @@ -205,6 +205,7 @@ 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. @@ -251,6 +252,7 @@ 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 30d5bd69..58cd1620 100644 --- a/pineappl_cli/src/merge.rs +++ b/pineappl_cli/src/merge.rs @@ -6,9 +6,10 @@ 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 d7b27ff9..cf42efbf 100644 --- a/pineappl_cli/src/plot.rs +++ b/pineappl_cli/src/plot.rs @@ -160,6 +160,7 @@ 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 f01358d6..74267881 100644 --- a/pineappl_cli/src/write.rs +++ b/pineappl_cli/src/write.rs @@ -16,6 +16,7 @@ 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. @@ -494,6 +495,7 @@ 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 dbf0d107..1d52984a 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 = "Convolutes a PineAPPL grid with a PDF set +const HELP_STR: &str = "Convolves 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 fca7b9e1..bd2f6da6 100644 --- a/pineappl_cli/tests/import.rs +++ b/pineappl_cli/tests/import.rs @@ -656,6 +656,7 @@ 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() { @@ -831,6 +832,7 @@ 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 0ba04dce..01b01972 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 Convolutes a PineAPPL grid with a PDF set + convolve Convolves 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 ae57dc5a..370a3db3 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: