Skip to content

Commit

Permalink
Revert "fix all warnings from clippy (non-deps related)"
Browse files Browse the repository at this point in the history
This reverts commit ced2f8e.
  • Loading branch information
Radonirinaunimi committed Oct 1, 2024
1 parent ced2f8e commit ead8262
Show file tree
Hide file tree
Showing 24 changed files with 7 additions and 61 deletions.
2 changes: 1 addition & 1 deletion docs/cli-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -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] <INPUT> <PDFSETS>...

Expand Down
2 changes: 0 additions & 2 deletions pineappl/src/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ pub enum ParseBinRemapperError {
},
}

#[allow(clippy::assigning_clones)]
impl FromStr for BinRemapper {
type Err = ParseBinRemapperError;

Expand Down Expand Up @@ -788,7 +787,6 @@ impl BinLimits {
}
}

#[allow(clippy::float_cmp)]
#[cfg(test)]
mod test {
use super::*;
Expand Down
1 change: 0 additions & 1 deletion pineappl/src/convolutions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ impl<'a> LumiCache<'a> {
}

/// Set the grids.
#[allow(clippy::float_cmp)]
pub fn set_grids(
&mut self,
mu2_grid: &[Mu2],
Expand Down
1 change: 0 additions & 1 deletion pineappl/src/empty_subgrid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ impl Subgrid for EmptySubgridV1 {
}
}

#[allow(clippy::float_cmp)]
#[cfg(test)]
mod tests {
use super::*;
Expand Down
1 change: 0 additions & 1 deletion pineappl/src/fk_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ impl FkTable {
}
}

#[allow(clippy::float_cmp)]
impl TryFrom<Grid> for FkTable {
type Error = TryFromGridError;

Expand Down
17 changes: 1 addition & 16 deletions pineappl/src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SubgridEnum>,
Expand Down Expand Up @@ -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<Channel>,
orders: Vec<Order>,
Expand Down Expand Up @@ -335,7 +333,6 @@ impl Grid {
/// # Panics
///
/// TODO
#[allow(clippy::float_cmp)]
pub fn convolve(
&self,
lumi_cache: &mut LumiCache,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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<anyhow::Error>>(
&self,
slices: impl IntoIterator<Item = Result<(OperatorSliceInfo, CowArray<'a, f64, Ix4>), E>>,
Expand Down Expand Up @@ -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<anyhow::Error>>(
&self,
slices_a: impl IntoIterator<Item = Result<(OperatorSliceInfo, CowArray<'a, f64, Ix4>), E>>,
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 0 additions & 3 deletions pineappl/src/import_only_subgrid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -435,7 +433,6 @@ impl From<&SubgridEnum> for ImportOnlySubgridV2 {
}
}

#[allow(clippy::float_cmp)]
#[cfg(test)]
mod tests {
use super::*;
Expand Down
5 changes: 0 additions & 5 deletions pineappl/src/lagrange_subgrid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -414,7 +412,6 @@ pub struct LagrangeSubgridV2 {
pub(crate) static_q2: f64,
}

#[allow(clippy::float_cmp)]
impl LagrangeSubgridV2 {
/// Constructor.
#[must_use]
Expand Down Expand Up @@ -496,7 +493,6 @@ impl LagrangeSubgridV2 {
}
}

#[allow(clippy::float_cmp)]
impl Subgrid for LagrangeSubgridV2 {
fn convolve(
&self,
Expand Down Expand Up @@ -1059,7 +1055,6 @@ impl From<&LagrangeSubgridV1> for LagrangeSparseSubgridV1 {
}
}

#[allow(clippy::float_cmp)]
#[cfg(test)]
mod tests {
use super::*;
Expand Down
1 change: 0 additions & 1 deletion pineappl/src/pids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<i32> {
let mut tuples = tuples.to_vec();
Expand Down
2 changes: 0 additions & 2 deletions pineappl/src/sparse_array3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ impl<T: Clone + Default + PartialEq> SparseArray3<T> {
}

/// 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()
}
Expand Down Expand Up @@ -421,7 +420,6 @@ impl<T: Clone + Default + PartialEq> SparseArray3<T> {
}
}

#[allow(clippy::float_cmp)]
#[cfg(test)]
mod tests {
use super::*;
Expand Down
2 changes: 0 additions & 2 deletions pineappl/tests/drell_yan_lo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 0 additions & 8 deletions pineappl_capi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,6 @@ pub unsafe extern "C" fn pineappl_grid_clone(grid: *const Grid) -> Box<Grid> {
}

/// 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"
Expand Down Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions pineappl_cli/src/convolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion pineappl_cli/src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ pub struct Opts {
digits_rel: usize,
}

#[allow(clippy::float_cmp)]
impl Subcommand for Opts {
fn run(&self, cfg: &GlobalConfiguration) -> Result<ExitCode> {
let grid1 = helpers::read_grid(&self.input1)?;
Expand Down
1 change: 0 additions & 1 deletion pineappl_cli/src/evolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ExitCode> {
use prettytable::row;
Expand Down
2 changes: 0 additions & 2 deletions pineappl_cli/src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -98,7 +97,6 @@ pub struct Opts {
digits_rel: usize,
}

#[allow(clippy::float_cmp)]
impl Subcommand for Opts {
fn run(&self, cfg: &GlobalConfiguration) -> Result<ExitCode> {
use prettytable::{cell, row};
Expand Down
2 changes: 0 additions & 2 deletions pineappl_cli/src/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -252,7 +251,6 @@ pub struct Opts {
dis_pid: i32,
}

#[allow(clippy::float_cmp)]
impl Subcommand for Opts {
fn run(&self, cfg: &GlobalConfiguration) -> Result<ExitCode> {
use prettytable::{cell, row};
Expand Down
3 changes: 1 addition & 2 deletions pineappl_cli/src/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion pineappl_cli/src/plot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ExitCode> {
ThreadPoolBuilder::new()
Expand Down
2 changes: 0 additions & 2 deletions pineappl_cli/src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -495,7 +494,6 @@ impl Args for MoreArgs {
}
}

#[allow(clippy::range_plus_one)]
impl Subcommand for Opts {
fn run(&self, _: &GlobalConfiguration) -> Result<ExitCode> {
let mut grid = helpers::read_grid(&self.input)?;
Expand Down
2 changes: 1 addition & 1 deletion pineappl_cli/tests/convolve.rs
Original file line number Diff line number Diff line change
@@ -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] <INPUT> <CONV_FUNS>...
Expand Down
2 changes: 0 additions & 2 deletions pineappl_cli/tests/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -832,7 +831,6 @@ fn import_dis_fktable() {
);
}

#[allow(clippy::float_cmp)]
#[test]
#[cfg(feature = "fktable")]
fn import_hadronic_fktable() {
Expand Down
2 changes: 1 addition & 1 deletion pineappl_cli/tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Usage: pineappl [OPTIONS] <COMMAND>
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
Expand Down
2 changes: 1 addition & 1 deletion pineappl_cli/tests/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const HELP_STR: &str = "Merges one or more PineAPPL grids together
Usage: pineappl merge <OUTPUT> <INPUT>...
Arguments:
<OUTPUT> Path of the merged `PineAPPL` file
<OUTPUT> Path of the merged PineAPPL file
<INPUT>... Path(s) of the files that should be merged
Options:
Expand Down

0 comments on commit ead8262

Please sign in to comment.