@@ -26,44 +26,29 @@ bitflags::bitflags! {
2626}
2727
2828impl ShouldRunMeta {
29+ #[ inline]
2930 pub fn new ( ) -> Self {
3031 ShouldRunMeta :: empty ( )
3132 }
3233
33- pub fn with_run ( self , yes : bool ) -> Self {
34- let other = ShouldRunMeta :: IS_RUN ;
35- if yes {
36- self . union ( other)
37- } else {
38- self . difference ( other)
39- }
34+ pub fn with_run ( mut self , yes : bool ) -> Self {
35+ self . set ( ShouldRunMeta :: IS_RUN , yes) ;
36+ self
4037 }
4138
42- pub fn with_run_once ( self , yes : bool ) -> Self {
43- let other = ShouldRunMeta :: IS_RUN_ONCE ;
44- if yes {
45- self . union ( other)
46- } else {
47- self . difference ( other)
48- }
39+ pub fn with_run_once ( mut self , yes : bool ) -> Self {
40+ self . set ( ShouldRunMeta :: IS_RUN_ONCE , yes) ;
41+ self
4942 }
5043
51- pub fn with_run_on_symbol ( self , yes : bool ) -> Self {
52- let other = ShouldRunMeta :: IS_RUN_ON_SYMBOL ;
53- if yes {
54- self . union ( other)
55- } else {
56- self . difference ( other)
57- }
44+ pub fn with_run_on_symbol ( mut self , yes : bool ) -> Self {
45+ self . set ( ShouldRunMeta :: IS_RUN_ON_SYMBOL , yes) ;
46+ self
5847 }
5948
60- pub fn with_run_on_jest_node ( self , yes : bool ) -> Self {
61- let other = ShouldRunMeta :: IS_RUN_ON_JEST_NODE ;
62- if yes {
63- self . union ( other)
64- } else {
65- self . difference ( other)
66- }
49+ pub fn with_run_on_jest_node ( mut self , yes : bool ) -> Self {
50+ self . set ( ShouldRunMeta :: IS_RUN_ON_JEST_NODE , yes) ;
51+ self
6752 }
6853}
6954
@@ -110,7 +95,7 @@ pub trait Rule: Sized + Default + fmt::Debug {
11095 #[ expect( unused_variables) ]
11196 #[ inline]
11297 fn should_run ( & self , ctx : & ContextHost ) -> ShouldRunMeta {
113- ShouldRunMeta :: new ( ) . with_run ( true )
98+ ShouldRunMeta :: IS_RUN
11499 }
115100}
116101
0 commit comments