Skip to content

Commit 033fbda

Browse files
committed
Incorporate Sasha's feedback to clarify ordering is not what matters in non-compliant example
1 parent a190c02 commit 033fbda

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/coding-guidelines/macros.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Macros
3333
where we have unique behavior intended for a particular expression.
3434

3535
If needing to specialize logic within the macro based on a particular
36-
expression's value, it may be better to not use a declarative macro.
36+
expression's value, it is better to not use a declarative macro.
3737

3838
.. non_compliant_example::
3939
:id: non_compl_ex_5vK0CCmePkef
@@ -43,6 +43,11 @@ Macros
4343
matching is done sequentially through the matchers and stops at the first
4444
match, the specialized case for EmergencyValve is unreachable.
4545

46+
The example would also be non-compliant if the ordering of the matchers
47+
were reversed as this introduces the possibility of future human-error
48+
when refactoring the macro to place the specialized matcher after the
49+
generic matcher.
50+
4651
.. code-block:: rust
4752
4853
#[derive(Debug)]

0 commit comments

Comments
 (0)