Skip to content

Commit 996fd3e

Browse files
committed
clippy suggestions.
1 parent b93772f commit 996fd3e

2 files changed

Lines changed: 11 additions & 15 deletions

File tree

‎src/geometry.rs‎

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl Geometry for Mesh0D {
5757
"NM" => NM,
5858
"M" => 1.,
5959
_ => input.length_unit.parse()
60-
.unwrap_or_else(|_| panic!("Input errror: could nor parse length unit {}. Use a valid float or one of ANGSTROM, NM, MICRON, CM, MM, M",
60+
.unwrap_or_else(|_| panic!("Input errror: could nor parse length unit {}. Use a valid float or one of ANGSTROM, NM, MICRON, CM, MM, M",
6161
&input.length_unit.as_str())),
6262
};
6363

@@ -295,7 +295,7 @@ impl Geometry for HomogeneousMesh2D {
295295
"NM" => NM,
296296
"M" => 1.,
297297
_ => input.length_unit.parse()
298-
.unwrap_or_else(|_| panic!("Input errror: could nor parse length unit {}. Use a valid float or one of ANGSTROM, NM, MICRON, CM, MM, M",
298+
.unwrap_or_else(|_| panic!("Input errror: could nor parse length unit {}. Use a valid float or one of ANGSTROM, NM, MICRON, CM, MM, M",
299299
&input.length_unit.as_str())),
300300
};
301301

@@ -353,16 +353,14 @@ impl Geometry for HomogeneousMesh2D {
353353
fn inside_energy_barrier(&self, x: f64, y: f64, z: f64) -> bool {
354354
if self.inside(x, y, z) {
355355
true
356-
} else {
357-
if let Closest::SinglePoint(p) = self.boundary.closest_point(&point!(x: x, y: y)) {
358-
let distance = ((x - p.x()).powi(2) + (y - p.y()).powi(2)).sqrt();
359-
distance < self.energy_barrier_thickness
360-
} else if let Closest::Intersection(p) = self.boundary.closest_point(&point!(x: x, y: y)) {
361-
true
362-
} else {
363-
panic!("Geometry error: closest point routine failed to find single closest point to ({}, {}, {}).", x, y, z);
364-
}
365-
}
356+
} else if let Closest::SinglePoint(p) = self.boundary.closest_point(&point!(x: x, y: y)) {
357+
let distance = ((x - p.x()).powi(2) + (y - p.y()).powi(2)).sqrt();
358+
distance < self.energy_barrier_thickness
359+
} else if let Closest::Intersection(p) = self.boundary.closest_point(&point!(x: x, y: y)) {
360+
true
361+
} else {
362+
panic!("Geometry error: closest point routine failed to find single closest point to ({}, {}, {}).", x, y, z);
363+
}
366364
}
367365
fn closest_point(&self, x: f64, y: f64, z: f64) -> (f64, f64, f64) {
368366
if let Closest::SinglePoint(p) = self.boundary.closest_point(&point!(x: x, y: y)) {
@@ -401,7 +399,7 @@ impl Mesh2D {
401399
/// Finds the cell that is nearest to (x, y).
402400
fn nearest_to(&self, x: f64, y: f64, z: f64) -> &Cell2D {
403401

404-
let mut min_distance: f64 = std::f64::MAX;
402+
let mut min_distance: f64 = f64::MAX;
405403
let mut index: usize = 0;
406404

407405
for (cell_index, cell) in self.mesh.iter().enumerate() {

‎src/particle.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
use super::*;
22

3-
/// Rustbca's internal representation of the particle_parameters input.
4-
53
fn default_vec_zero() -> Vec<usize> {
64
vec![0]
75
}

0 commit comments

Comments
 (0)