Skip to content

Commit

Permalink
Merge pull request #1506 from zthompson47/resolve-large-variant-warnings
Browse files Browse the repository at this point in the history
Box large error variants
  • Loading branch information
hannobraun authored Jan 13, 2023
2 parents 224a384 + f4dcfc1 commit 55bb16e
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 41 deletions.
3 changes: 0 additions & 3 deletions crates/fj-host/src/model.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::result_large_err)]

use std::{
io,
path::{Path, PathBuf},
Expand Down Expand Up @@ -257,7 +255,6 @@ fn ambiguous_path_error(
}

/// An error that can occur when loading or reloading a model
#[allow(clippy::large_enum_variant)]
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// Error loading model library
Expand Down
2 changes: 0 additions & 2 deletions crates/fj-host/src/watcher.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::result_large_err)]

use std::{collections::HashSet, ffi::OsStr, path::Path};

use crossbeam_channel::Sender;
Expand Down
5 changes: 0 additions & 5 deletions crates/fj-kernel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@
//! [Fornjot]: https://www.fornjot.app/
#![warn(missing_docs)]
// I've made a simple change that put `ValidationError` over the threshold for
// this warning. I couldn't come up with an easy fix, and figured that silencing
// the warning is the most practical solution for now, as the validation
// infrastructure is in flux anyway. Maybe the problem will take care of itself.
#![allow(clippy::result_large_err)]

pub mod algorithms;
pub mod builder;
Expand Down
16 changes: 8 additions & 8 deletions crates/fj-kernel/src/validate/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ impl HalfEdgeValidationError {

if back_curve.id() != front_curve.id() {
errors.push(
Self::CurveMismatch {
Box::new(Self::CurveMismatch {
back_curve: back_curve.clone(),
front_curve: front_curve.clone(),
half_edge: half_edge.clone(),
}
})
.into(),
);
}
Expand All @@ -149,12 +149,12 @@ impl HalfEdgeValidationError {

if global_curve_from_curve.id() != global_curve_from_global_form.id() {
errors.push(
Self::GlobalCurveMismatch {
Box::new(Self::GlobalCurveMismatch {
global_curve_from_curve: global_curve_from_curve.clone(),
global_curve_from_global_form:
global_curve_from_global_form.clone(),
half_edge: half_edge.clone(),
}
})
.into(),
);
}
Expand Down Expand Up @@ -188,11 +188,11 @@ impl HalfEdgeValidationError {

if ids_from_vertices != ids_from_global_form {
errors.push(
Self::GlobalVertexMismatch {
Box::new(Self::GlobalVertexMismatch {
global_vertices_from_vertices,
global_vertices_from_global_form,
half_edge: half_edge.clone(),
}
})
.into(),
);
}
Expand All @@ -210,12 +210,12 @@ impl HalfEdgeValidationError {

if distance < config.distinct_min_distance {
errors.push(
Self::VerticesAreCoincident {
Box::new(Self::VerticesAreCoincident {
back_position,
front_position,
distance,
half_edge: half_edge.clone(),
}
})
.into(),
);
}
Expand Down
8 changes: 4 additions & 4 deletions crates/fj-kernel/src/validate/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ impl FaceValidationError {
for interior in face.interiors() {
if surface.id() != interior.surface().id() {
errors.push(
Self::SurfaceMismatch {
Box::new(Self::SurfaceMismatch {
surface: surface.clone(),
interior: interior.clone(),
face: face.clone(),
}
})
.into(),
);
}
Expand All @@ -84,11 +84,11 @@ impl FaceValidationError {

if exterior_winding == interior_winding {
errors.push(
Self::InvalidInteriorWinding {
Box::new(Self::InvalidInteriorWinding {
exterior_winding,
interior_winding,
face: face.clone(),
}
})
.into(),
);
}
Expand Down
8 changes: 4 additions & 4 deletions crates/fj-kernel/src/validate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,19 @@ pub enum ValidationError {

/// `Face` validation error
#[error(transparent)]
Face(#[from] FaceValidationError),
Face(#[from] Box<FaceValidationError>),

/// `HalfEdge` validation error
#[error(transparent)]
HalfEdge(#[from] HalfEdgeValidationError),
HalfEdge(#[from] Box<HalfEdgeValidationError>),

/// `SurfaceVertex` validation error
#[error(transparent)]
SurfaceVertex(#[from] SurfaceVertexValidationError),
SurfaceVertex(#[from] Box<SurfaceVertexValidationError>),

/// `Vertex` validation error
#[error(transparent)]
Vertex(#[from] VertexValidationError),
Vertex(#[from] Box<VertexValidationError>),
}

impl From<Infallible> for ValidationError {
Expand Down
12 changes: 6 additions & 6 deletions crates/fj-kernel/src/validate/vertex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ impl VertexValidationError {

if curve_surface.id() != surface_form_surface.id() {
errors.push(
Self::SurfaceMismatch {
Box::new(Self::SurfaceMismatch {
curve_surface: curve_surface.clone(),
surface_form_surface: surface_form_surface.clone(),
}
})
.into(),
);
}
Expand All @@ -111,12 +111,12 @@ impl VertexValidationError {

if distance > config.identical_max_distance {
errors.push(
Self::PositionMismatch {
Box::new(Self::PositionMismatch {
vertex: vertex.clone(),
surface_vertex: vertex.surface_form().clone_object(),
curve_position_as_surface,
distance,
}
})
.into(),
);
}
Expand Down Expand Up @@ -165,12 +165,12 @@ impl SurfaceVertexValidationError {

if distance > config.identical_max_distance {
errors.push(
Self::PositionMismatch {
Box::new(Self::PositionMismatch {
surface_vertex: surface_vertex.clone(),
global_vertex: surface_vertex.global_form().clone_object(),
surface_position_as_global,
distance,
}
})
.into(),
);
}
Expand Down
5 changes: 0 additions & 5 deletions crates/fj-operations/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
//! [`fj`]: https://crates.io/crates/fj
#![warn(missing_docs)]
// I've made a simple change that put `ValidationError` over the threshold for
// this warning. I couldn't come up with an easy fix, and figured that silencing
// the warning is the most practical solution for now, as the validation
// infrastructure is in flux anyway. Maybe the problem will take care of itself.
#![allow(clippy::result_large_err)]

pub mod shape_processor;

Expand Down
1 change: 0 additions & 1 deletion crates/fj-operations/src/shape_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ impl ShapeProcessor {
}

/// A shape processing error
#[allow(clippy::large_enum_variant)]
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// Error converting to shape
Expand Down
1 change: 0 additions & 1 deletion crates/fj-window/src/event_loop_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ pub struct EventLoopHandler {
}

impl EventLoopHandler {
#[allow(clippy::result_large_err)]
pub fn handle_event(
&mut self,
event: Event<ModelEvent>,
Expand Down
2 changes: 0 additions & 2 deletions crates/fj-window/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
//! Provides the functionality to create a window and perform basic viewing
//! with programmed models.
#![allow(clippy::result_large_err)]

use std::{
error,
fmt::{self, Write},
Expand Down

0 comments on commit 55bb16e

Please sign in to comment.