Skip to content

Commit 3a46fd0

Browse files
committed
cargo fmt with 1.85.0
1 parent 63b8426 commit 3a46fd0

33 files changed

+254
-147
lines changed

splashsurf/src/convert.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use crate::io;
2-
use anyhow::anyhow;
32
use anyhow::Context;
3+
use anyhow::anyhow;
44
use clap::value_parser;
55
use log::info;
66
use splashsurf_lib::mesh::MeshWithData;
77
use splashsurf_lib::nalgebra::Vector3;
8-
use splashsurf_lib::{nalgebra, profile, Aabb3d};
8+
use splashsurf_lib::{Aabb3d, nalgebra, profile};
99
use std::path::PathBuf;
1010

1111
// TODO: Support double input/output
@@ -62,8 +62,11 @@ pub fn convert_subcommand(cmd_args: &ConvertSubcommandArgs) -> Result<(), anyhow
6262
match (&cmd_args.input_particles, &cmd_args.input_mesh) {
6363
(Some(_), _) => convert_particles(cmd_args)?,
6464
(_, Some(_)) => convert_mesh(cmd_args)?,
65-
(_, _) => return Err(anyhow!(
66-
"Aborting: No input file specified, either a particle or mesh input file has to be specified."))
65+
(_, _) => {
66+
return Err(anyhow!(
67+
"Aborting: No input file specified, either a particle or mesh input file has to be specified."
68+
));
69+
}
6770
}
6871

6972
Ok(())

splashsurf/src/io.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use crate::io::vtk_format::VtkFile;
2-
use anyhow::{anyhow, Context};
2+
use anyhow::{Context, anyhow};
33
use log::{info, warn};
4+
use splashsurf_lib::Real;
45
use splashsurf_lib::mesh::{
56
IntoVtkUnstructuredGridPiece, Mesh3d, MeshAttribute, MeshWithData, TriMesh3d,
67
};
78
use splashsurf_lib::nalgebra::Vector3;
8-
use splashsurf_lib::Real;
99
use splashsurf_lib::{io, profile};
1010
use std::collections::HashSet;
1111
use std::fs::File;

splashsurf/src/reconstruction.rs

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use crate::reconstruction::arguments::*;
22
use crate::{io, logging};
3-
use anyhow::{anyhow, Context};
3+
use anyhow::{Context, anyhow};
44
use clap::value_parser;
55
use indicatif::{ProgressBar, ProgressStyle};
66
use log::{error, info};
77
use rayon::prelude::*;
88
use splashsurf_lib::mesh::{AttributeData, Mesh3d, MeshAttribute, MeshWithData};
99
use splashsurf_lib::nalgebra::{Unit, Vector3};
1010
use splashsurf_lib::sph_interpolation::SphInterpolator;
11-
use splashsurf_lib::{profile, Aabb3d, Index, Real};
11+
use splashsurf_lib::{Aabb3d, Index, Real, profile};
1212
use std::borrow::Cow;
1313
use std::collections::HashMap;
1414
use std::convert::TryFrom;
@@ -423,11 +423,11 @@ pub fn reconstruct_subcommand(cmd_args: &ReconstructSubcommandArgs) -> Result<()
423423
mod arguments {
424424
use super::ReconstructSubcommandArgs;
425425
use crate::io;
426-
use anyhow::{anyhow, Context};
426+
use anyhow::{Context, anyhow};
427427
use log::info;
428-
use regex::{escape, Regex};
429-
use splashsurf_lib::nalgebra::Vector3;
428+
use regex::{Regex, escape};
430429
use splashsurf_lib::Aabb3d;
430+
use splashsurf_lib::nalgebra::Vector3;
431431
use std::convert::TryFrom;
432432
use std::fs;
433433
use std::path::{Path, PathBuf};
@@ -484,7 +484,11 @@ mod arguments {
484484
);
485485

486486
if !aabb.is_consistent() {
487-
return Err(anyhow!("The user specified {error_str} min/max values are inconsistent! min: {:?} max: {:?}", aabb.min().as_slice(), aabb.max().as_slice()));
487+
return Err(anyhow!(
488+
"The user specified {error_str} min/max values are inconsistent! min: {:?} max: {:?}",
489+
aabb.min().as_slice(),
490+
aabb.max().as_slice()
491+
));
488492
}
489493

490494
if aabb.is_degenerate() {
@@ -632,7 +636,11 @@ mod arguments {
632636
// Ensure that output directory exists/create it
633637
if let Some(output_dir) = output_file.parent() {
634638
if !output_dir.exists() {
635-
info!("The output directory \"{}\" of the output file \"{}\" does not exist. Trying to create it now...", output_dir.display(), output_file.display());
639+
info!(
640+
"The output directory \"{}\" of the output file \"{}\" does not exist. Trying to create it now...",
641+
output_dir.display(),
642+
output_file.display()
643+
);
636644
fs::create_dir_all(output_dir).with_context(|| {
637645
format!(
638646
"Unable to create output directory \"{}\"",
@@ -776,7 +784,7 @@ mod arguments {
776784
return Err(anyhow!(
777785
"The input file path \"{}\" does not end with a filename",
778786
args.input_file_or_sequence.display()
779-
))
787+
));
780788
}
781789
};
782790

@@ -975,7 +983,11 @@ pub(crate) fn reconstruction_pipeline_generic<I: Index, R: Real>(
975983
));
976984
let tris_after = mesh_with_data.mesh.triangles.len();
977985
let verts_after = mesh_with_data.mesh.vertices.len();
978-
info!("Post-processing: Cleanup reduced number of vertices to {:.2}% and number of triangles to {:.2}% of original mesh.", (verts_after as f64 / verts_before as f64) * 100.0, (tris_after as f64 / tris_before as f64) * 100.0)
986+
info!(
987+
"Post-processing: Cleanup reduced number of vertices to {:.2}% and number of triangles to {:.2}% of original mesh.",
988+
(verts_after as f64 / verts_before as f64) * 100.0,
989+
(tris_after as f64 / tris_before as f64) * 100.0
990+
)
979991
}
980992

981993
// Decimate mesh if requested
@@ -1320,13 +1332,19 @@ pub(crate) fn reconstruction_pipeline_generic<I: Index, R: Real>(
13201332
}
13211333
_ => unreachable!(),
13221334
} {
1323-
error!("Checked mesh for problems (holes: {}, non-manifold edges/vertices: {}), problems were found!", postprocessing.check_mesh_closed, postprocessing.check_mesh_manifold);
1335+
error!(
1336+
"Checked mesh for problems (holes: {}, non-manifold edges/vertices: {}), problems were found!",
1337+
postprocessing.check_mesh_closed, postprocessing.check_mesh_manifold
1338+
);
13241339
error!("{}", err);
13251340
return Err(anyhow!("{}", err))
13261341
.context(format!("Checked mesh for problems (holes: {}, non-manifold edges/vertices: {}), problems were found!", postprocessing.check_mesh_closed, postprocessing.check_mesh_manifold))
13271342
.context(format!("Problem found with mesh file \"{}\"", paths.output_file.display()));
13281343
} else {
1329-
info!("Checked mesh for problems (holes: {}, non-manifold edges/vertices: {}), no problems were found.", postprocessing.check_mesh_closed, postprocessing.check_mesh_manifold);
1344+
info!(
1345+
"Checked mesh for problems (holes: {}, non-manifold edges/vertices: {}), no problems were found.",
1346+
postprocessing.check_mesh_closed, postprocessing.check_mesh_manifold
1347+
);
13301348
}
13311349
}
13321350

splashsurf/src/tests/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::reconstruction::Switch;
21
use crate::Subcommand;
2+
use crate::reconstruction::Switch;
33
use std::path::PathBuf;
44

55
#[test]

splashsurf_lib/benches/benches/bench_aabb.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use criterion::{criterion_group, Criterion};
1+
use criterion::{Criterion, criterion_group};
22
use nalgebra::Vector3;
3-
use splashsurf_lib::io::particles_from_file;
43
use splashsurf_lib::Aabb3d;
4+
use splashsurf_lib::io::particles_from_file;
55
use std::time::Duration;
66

77
pub fn aabb_from_points(c: &mut Criterion) {

splashsurf_lib/benches/benches/bench_full.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use criterion::{criterion_group, Criterion};
1+
use criterion::{Criterion, criterion_group};
22
use nalgebra::Vector3;
33
use splashsurf_lib::io::particles_from_file;
44
#[allow(dead_code)]
55
use splashsurf_lib::io::vtk_format::write_vtk;
66
use splashsurf_lib::{
7-
reconstruct_surface, reconstruct_surface_inplace, GridDecompositionParameters, Parameters,
8-
SpatialDecomposition, SurfaceReconstruction,
7+
GridDecompositionParameters, Parameters, SpatialDecomposition, SurfaceReconstruction,
8+
reconstruct_surface, reconstruct_surface_inplace,
99
};
1010
use std::time::Duration;
1111

splashsurf_lib/benches/benches/bench_mesh.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use criterion::{criterion_group, Criterion};
1+
use criterion::{Criterion, criterion_group};
22
use splashsurf_lib::io::particles_from_file;
33
use splashsurf_lib::nalgebra::Vector3;
44
use splashsurf_lib::{
5-
reconstruct_surface, GridDecompositionParameters, Parameters, SpatialDecomposition,
6-
SurfaceReconstruction,
5+
GridDecompositionParameters, Parameters, SpatialDecomposition, SurfaceReconstruction,
6+
reconstruct_surface,
77
};
88
use std::path::Path;
99
use std::time::Duration;

splashsurf_lib/benches/benches/bench_neighborhood.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use criterion::{criterion_group, Criterion};
1+
use criterion::{Criterion, criterion_group};
22
use nalgebra::Vector3;
33
use splashsurf_lib::io;
4-
use splashsurf_lib::{neighborhood_search, Aabb3d};
4+
use splashsurf_lib::{Aabb3d, neighborhood_search};
55
use std::time::Duration;
66

77
static PARTICLE_RADIUS: f64 = 0.025;

splashsurf_lib/benches/benches/bench_subdomain_grid.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use criterion::{criterion_group, Criterion, SamplingMode};
1+
use criterion::{Criterion, SamplingMode, criterion_group};
22
use nalgebra::Vector3;
33
use splashsurf_lib::io::particles_from_file;
44
use splashsurf_lib::{
5-
reconstruct_surface, GridDecompositionParameters, Parameters, SpatialDecomposition,
6-
SurfaceReconstruction,
5+
GridDecompositionParameters, Parameters, SpatialDecomposition, SurfaceReconstruction,
6+
reconstruct_surface,
77
};
88
use std::time::Duration;
99

splashsurf_lib/examples/minimal_levelset.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
33
use anyhow::anyhow;
44
use sdfu::SDF;
5+
use splashsurf_lib::Aabb3d;
6+
use splashsurf_lib::Real;
57
#[cfg(feature = "io")]
68
use splashsurf_lib::io;
79
use splashsurf_lib::marching_cubes::marching_cubes_lut::marching_cubes_triangulation_iter;
810
use splashsurf_lib::mesh::TriMesh3d;
911
use splashsurf_lib::nalgebra::Vector3;
1012
use splashsurf_lib::uniform_grid::UniformCartesianCubeGrid3d;
11-
use splashsurf_lib::Aabb3d;
12-
use splashsurf_lib::Real;
1313
use std::collections::HashMap;
1414
use ultraviolet::vec::Vec3;
1515

0 commit comments

Comments
 (0)