Skip to content

Adjust attributes on steps for better diagnostics

Daniel Silverstone requested to merge fix-271 into main

Description

Previously in our derive we were setting step functions to #[allow(unused)] which was there to prevent dead code warnings if steps weren't used. This was useful for permitting users to share step function libraries among scenario files without needing to worry if steps were used in any particular combination of scenarios, but it also masked the situation where a step function failed to correctly use values marked #[must_use] such as Result<>s. This MR adjusts the attributes added to step functions to deny unused must_use values, and to directly target the dead_code lint instead.

This allowed a number of cases of this bug to be brought to light, which are also fixed in this MR.

All in all, this means there is no need to add #[must_use] to subplotlib since it turns out that once we stop hiding the warnings, the compiler is already doing the right thing. This therefore closes #271 (closed)

Checklist

  • You have read, and followed the guidance in, the CONTRIBUTING guide
  • The MR content has run through a pipeline, or at least has pipelines enabled.
  • There are no licence concerns with this contribution (The README clearly states Subplot is MIT-0)

Merge request reports