Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnbr committed Mar 27, 2024
1 parent f12d23f commit 6b87936
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 143 deletions.
105 changes: 6 additions & 99 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/api/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ impl PythonWorker {
.export_numerator(export_root, Self::printer_options(format))
.map_err(|e| exceptions::PyException::new_err(e.to_string()))?;
}
Ok(format!("Exported numerators"))
Ok("Exported numerators".to_string())
}

pub fn export_coupling_replacement_rules(
Expand All @@ -333,7 +333,7 @@ impl PythonWorker {
self.model
.export_coupling_replacement_rules(export_root, Self::printer_options(format))
.map_err(|e| exceptions::PyException::new_err(e.to_string()))?;
Ok(format!("Exported coupling substitutions"))
Ok("Exported coupling substitutions".to_string())
}

pub fn export_lmb_subs(&self, export_root: &str, format: &str) -> PyResult<String> {
Expand All @@ -343,7 +343,7 @@ impl PythonWorker {
.map_err(|e| exceptions::PyException::new_err(e.to_string()))
.unwrap();
}
Ok(format!("Exported lmb substitutions"))
Ok("Exported lmb substitutions".to_string())
}

pub fn inspect_integrand(
Expand Down
2 changes: 1 addition & 1 deletion src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ impl Graph {
for (i, signature) in lmb.edge_signatures.iter().enumerate() {
rule.push((
Atom::parse(&format!("Q{}(x{}__)", i, i)).unwrap(),
self.replacement_rule_from_signature(i, &signature),
self.replacement_rule_from_signature(i, signature),
));
}

Expand Down
4 changes: 2 additions & 2 deletions src/numerator/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use crate::{tensor::SymbolicTensor, tests_from_pytest::load_amplitude_output};
#[test]
#[allow(unused)]
fn lbl() {
let (model, amplitude) = load_amplitude_output(&"./src/test_resources/lbl/");
let (model, amplitude) = load_amplitude_output("./src/test_resources/lbl/");

model
.export_coupling_replacement_rules(&"./ignore/", PrintOptions::mathematica())
.export_coupling_replacement_rules("./ignore/", PrintOptions::mathematica())
.unwrap();
let mut graph = amplitude.amplitude_graphs[0].graph.clone();

Expand Down
48 changes: 10 additions & 38 deletions src/tensor/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ where
})
.collect();

if let Some(data) = data {
Some(DenseTensor { structure, data })
} else {
None
}
data.map(|data| DenseTensor { structure, data })
}
}

Expand All @@ -62,11 +58,7 @@ where
})
.collect();

if let Some(data) = data {
Some(DenseTensor { structure, data })
} else {
None
}
data.map(|data| DenseTensor { structure, data })
}
}

Expand All @@ -92,11 +84,7 @@ where
})
.collect();

if let Some(data) = data {
Some(DenseTensor { structure, data })
} else {
None
}
data.map(|data| DenseTensor { structure, data })
}
}

Expand Down Expand Up @@ -221,11 +209,7 @@ where
})
.collect();

if let Some(data) = data {
Some(DenseTensor { structure, data })
} else {
None
}
data.map(|data| DenseTensor { structure, data })
}
}

Expand All @@ -250,11 +234,7 @@ where
})
.collect();

if let Some(data) = data {
Some(DenseTensor { structure, data })
} else {
None
}
data.map(|data| DenseTensor { structure, data })
}
}

Expand All @@ -280,11 +260,7 @@ where
})
.collect();

if let Some(data) = data {
Some(DenseTensor { structure, data })
} else {
None
}
data.map(|data| DenseTensor { structure, data })
}
}

Expand Down Expand Up @@ -401,14 +377,10 @@ where
fn scalar_mul(self, rhs: &T) -> Option<Self::Output> {
let data: Option<Vec<Out>> = self.iter_flat().map(|(_, u)| u.mul_fallible(rhs)).collect();

if let Some(data) = data {
Some(DenseTensor {
structure: self.structure().clone(),
data,
})
} else {
None
}
data.map(|data| DenseTensor {
structure: self.structure().clone(),
data,
})
}
}

Expand Down

0 comments on commit 6b87936

Please sign in to comment.