From 2a2655def8ac47cd859ef32b32291195913a19a7 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Tue, 22 Oct 2024 10:01:29 -0400 Subject: [PATCH] refactor(naga): use named fields for `ExpressionError::InvalidBinaryOperandTypes` --- naga/src/valid/expression.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/naga/src/valid/expression.rs b/naga/src/valid/expression.rs index 7f693c13b..bf44e8608 100644 --- a/naga/src/valid/expression.rs +++ b/naga/src/valid/expression.rs @@ -39,12 +39,12 @@ pub enum ExpressionError { IndexableLength(#[from] IndexableLengthError), #[error("Operation {0:?} can't work with {1:?}")] InvalidUnaryOperandType(crate::UnaryOperator, Handle), - #[error("Operation {0:?} can't work with {1:?} and {2:?}")] - InvalidBinaryOperandTypes( - crate::BinaryOperator, - Handle, - Handle, - ), + #[error("Operation {op:?} can't work with {lhs:?} and {rhs:?}")] + InvalidBinaryOperandTypes { + op: crate::BinaryOperator, + lhs: Handle, + rhs: Handle, + }, #[error("Selecting is not possible")] InvalidSelectTypes, #[error("Relational argument {0:?} is not a boolean vector")] @@ -847,7 +847,11 @@ impl super::Validator { function.expressions[right], right_inner ); - return Err(ExpressionError::InvalidBinaryOperandTypes(op, left, right)); + return Err(ExpressionError::InvalidBinaryOperandTypes { + op, + lhs: left, + rhs: right, + }); } ShaderStages::all() }