-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Description
The write_view_segment function in src/simlin-engine/src/mdl/writer.rs takes 8 parameters, which triggers clippy's too_many_arguments lint. The lint is currently suppressed with #[allow(clippy::too_many_arguments)].
Several of the parameters represent shared context that is threaded through the function: valve_uids, elem_positions, name_map, next_connector_uid, etc. These should be grouped into a context struct (e.g., ViewWriteContext) to improve readability and reduce the function signature size.
Why it matters
- Maintainability: Long parameter lists make it harder to understand what the function needs and easier to mix up arguments at call sites.
- Clippy compliance: Suppressing lints with
#[allow(...)]should be a last resort, not a permanent fixture. Reducing the parameter count removes the need for the suppression. - Developer experience: A context struct makes it clearer which pieces of state are related and passed together.
Component(s) affected
src/simlin-engine/src/mdl/writer.rs-- thewrite_view_segmentfunction
Possible approach
Introduce a struct (e.g., ViewWriteContext) that bundles the shared parameters:
valve_uidselem_positionsname_mapnext_connector_uid- any other context that is passed through multiple writer functions
Then replace the individual parameters with a single &mut ViewWriteContext reference.
Context
Identified during review of PR #397 (mdl-roundtrip-fidelity branch). This is a code quality improvement that does not affect correctness.