Skip to content

Commit 52996aa

Browse files
committed
Manual clippy fixes
1 parent 47d4556 commit 52996aa

File tree

7 files changed

+21
-23
lines changed

7 files changed

+21
-23
lines changed

splashsurf/src/reconstruction.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,17 +459,17 @@ mod arguments {
459459
}
460460

461461
fn try_aabb_from_min_max(
462-
min: &Vec<f64>,
463-
max: &Vec<f64>,
462+
min: &[f64],
463+
max: &[f64],
464464
error_str: &'static str,
465465
) -> Result<Aabb3d<f64>, anyhow::Error> {
466466
// This should already be ensured by StructOpt parsing
467467
assert_eq!(min.len(), 3);
468468
assert_eq!(max.len(), 3);
469469

470470
let aabb = Aabb3d::new(
471-
Vector3::from_iterator(min.clone()),
472-
Vector3::from_iterator(max.clone()),
471+
Vector3::from_column_slice(min),
472+
Vector3::from_column_slice(max),
473473
);
474474

475475
if !aabb.is_consistent() {

splashsurf_lib/src/aabb.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ where
209209

210210
/// Returns the geometric centroid of the AABB (mean of the corner points)
211211
pub fn centroid(&self) -> SVector<R, D> {
212-
&self.min + (self.extents() / (R::one() + R::one()))
212+
self.min + (self.extents() / (R::one() + R::one()))
213213
}
214214

215215
/// Checks if the given AABB is inside of the AABB, the AABB is considered to be half-open to its max coordinate
@@ -236,7 +236,7 @@ where
236236
/// Multiplies a uniform, local scaling to the AABB (i.e. multiplying its extents as if it was centered at the origin)
237237
pub fn scale_uniformly(&mut self, scaling: R) {
238238
let center = self.centroid();
239-
self.translate(&(&center * R::one().neg()));
239+
self.translate(&(center * R::one().neg()));
240240
self.min *= scaling;
241241
self.max *= scaling;
242242
self.translate(&center);

splashsurf_lib/src/io/bgeo_format.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -719,10 +719,7 @@ mod error {
719719
impl BgeoParserErrorKind {
720720
/// Returns whether the variant is an internal nom error
721721
pub fn is_nom_error(&self) -> bool {
722-
match self {
723-
BgeoParserErrorKind::NomError(_) => true,
724-
_ => false,
725-
}
722+
matches!(self, BgeoParserErrorKind::NomError(_))
726723
}
727724
}
728725

splashsurf_lib/src/io/vtk_format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ fn try_map_scalars_to_real<R: Real, T: Copy, F: Fn(T) -> Result<R, anyhow::Error
361361

362362
/// Tries to convert a vector of consecutive coordinate triplets into a vector of `Vector3`, also converts between floating point types
363363
fn particles_from_coords<RealOut: Real, RealIn: Real>(
364-
coords: &Vec<RealIn>,
364+
coords: &[RealIn],
365365
) -> Result<Vec<Vector3<RealOut>>, anyhow::Error> {
366366
if coords.len() % 3 != 0 {
367367
return Err(anyhow!(

splashsurf_lib/src/lib.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99
//! The following features are all non-default features to reduce the amount of additional dependencies.
1010
//!
1111
//! - **`vtk_extras`**: Enables helper functions and trait implementations to export meshes using [`vtkio`](https://github.com/elrnv/vtkio).
12-
//! In particular it adds `From` impls for the [mesh] types used by this crate to convert them to
13-
//! [`vtkio::model::UnstructuredGridPiece`](https://docs.rs/vtkio/0.6.*/vtkio/model/struct.UnstructuredGridPiece.html) and [`vtkio::model::DataSet`](https://docs.rs/vtkio/0.6.*/vtkio/model/enum.DataSet.html)
14-
//! types. If the feature is enabled, The crate exposes its `vtkio` dependency as `splashsurflib::vtkio`.
12+
//! In particular it adds `From` impls for the [mesh] types used by this crate to convert them to
13+
//! [`vtkio::model::UnstructuredGridPiece`](https://docs.rs/vtkio/0.6.*/vtkio/model/struct.UnstructuredGridPiece.html) and [`vtkio::model::DataSet`](https://docs.rs/vtkio/0.6.*/vtkio/model/enum.DataSet.html)
14+
//! types. If the feature is enabled, The crate exposes its `vtkio` dependency as `splashsurflib::vtkio`.
1515
//! - **`io`**: Enables the [`io`] module, containing functions to load and store particle and mesh files
16-
//! from various file formats, e.g. `VTK`, `OBJ`, `BGEO` etc. This feature implies the `vtk_extras` feature.
17-
//! It is disabled by default because a pure "online" surface reconstruction might not need any file IO.
18-
//! The feature adds several dependencies to support the file formats.
16+
//! from various file formats, e.g. `VTK`, `OBJ`, `BGEO` etc. This feature implies the `vtk_extras` feature.
17+
//! It is disabled by default because a pure "online" surface reconstruction might not need any file IO.
18+
//! The feature adds several dependencies to support the file formats.
1919
//! - **`profiling`**: Enables profiling of internal functions. The resulting data can be displayed using the functions
20-
//! from the [`profiling`] module of this crate. Furthermore, it exposes the [`profile`] macro that can be used e.g.
21-
//! by binary crates calling into this library to add their own profiling scopes to the measurements.
22-
//! If this features is not enabled, the macro will just expend to a no-op and remove the (small)
23-
//! performance overhead of the profiling.
20+
//! from the [`profiling`] module of this crate. Furthermore, it exposes the [`profile`] macro that can be used e.g.
21+
//! by binary crates calling into this library to add their own profiling scopes to the measurements.
22+
//! If this features is not enabled, the macro will just expend to a no-op and remove the (small)
23+
//! performance overhead of the profiling.
2424
//!
2525
2626
use log::info;

splashsurf_lib/src/marching_cubes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pub fn check_mesh_consistency<I: Index, R: Real>(
167167
.get_point(*cell_index.index())
168168
.expect("Unable to get point index of cell");
169169
let cell_center = grid.point_coordinates(&point_index)
170-
+ &Vector3::repeat(grid.cell_size().times_f64(0.5));
170+
+ Vector3::repeat(grid.cell_size().times_f64(0.5));
171171

172172
*error_string += &format!("\n\tTriangle {}, boundary edge {:?} is located in cell with {:?} with center coordinates {:?} and edge length {}.", tri_idx, edge, cell_index, cell_center, grid.cell_size());
173173
} else {
@@ -242,7 +242,7 @@ fn check_mesh_with_cell_data<I: Index, R: Real>(
242242
.get_point(*cell_index.index())
243243
.expect("Unable to get point index of cell");
244244
let cell_center = grid.point_coordinates(&point_index)
245-
+ &Vector3::repeat(grid.cell_size().times_f64(0.5));
245+
+ Vector3::repeat(grid.cell_size().times_f64(0.5));
246246

247247
let cell_data = marching_cubes_data
248248
.cell_data

splashsurf_lib/src/marching_cubes/narrow_band_extraction.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pub(crate) fn construct_mc_input<I: Index, R: Real>(
4242
/// For each cell, this function collects
4343
/// 1) an array with a flag per corner vertex, indicating whether it's above/below the iso-surface threshold
4444
/// 2) an array with an optional index per edge, referring to the interpolated vertex if the edge crosses the iso-surface
45+
///
4546
/// Note: The threshold flags in the resulting cell data are not complete and still have to be updated after
4647
/// this procedure using the [update_cell_data_threshold_flags] function.
4748
///

0 commit comments

Comments
 (0)