The TokenError enum in the FRC46 library contains a large StateInvariantError variant (192+ bytes) that triggers clippy warnings about large error types. I believe this impacts performance because Result<T, TokenError> types are frequently used throughout the FRC46 library so the warning is probably worth paying attention to.
Proposed Solution
Box the StateInvariant variant to reduce TokenError size:
#[derive(Error, Debug)]
pub enum TokenError {
// ... other variants unchanged
#[error("error in state invariants {0}")]
StateInvariant(Box<StateInvariantError>), // Box this variant
}
I think the public impact should be fairly minimal and won't change the exit code behaviour of FRC46 implementations.
But, I'm not entirely sure yet, which is why I'm not doing this right now!
The
TokenErrorenum in the FRC46 library contains a largeStateInvariantErrorvariant (192+ bytes) that triggers clippy warnings about large error types. I believe this impacts performance becauseResult<T, TokenError>types are frequently used throughout the FRC46 library so the warning is probably worth paying attention to.#[allow(clippy::result_large_err)]attributes as per PR fix(lint): ignore clippy result_large_err for now #254ResulttypesTokenErroralso inherit this performance penaltyProposed Solution
Box the
StateInvariantvariant to reduceTokenErrorsize:I think the public impact should be fairly minimal and won't change the exit code behaviour of FRC46 implementations.
But, I'm not entirely sure yet, which is why I'm not doing this right now!