@@ -14,31 +14,20 @@ pub trait Formula1<O: ThermodynamicQuantity, I1: ThermodynamicQuantity> {
14
14
#[ allow( clippy:: missing_errors_doc) ]
15
15
fn validate_inputs ( i1 : I1 ) -> Result < ( ) , InputError > ;
16
16
17
- #[ allow( clippy:: missing_errors_doc) ]
18
17
#[ allow( missing_docs) ]
18
+ #[ allow( clippy:: missing_errors_doc) ]
19
19
#[ inline]
20
- fn compute ( i1 : I1 ) -> Result < O , InputError > {
21
- cfg_if:: cfg_if! {
22
- if #[ cfg( feature = "debug" ) ] {
23
- cfg_if:: cfg_if! {
24
- if #[ cfg( debug_assertions) ] {
25
- Self :: validate_inputs_loggerr( i1) ?;
26
- }
27
- }
28
- } else {
29
- Self :: validate_inputs( i1) ?;
30
- }
31
- }
32
-
33
- Ok ( Self :: compute_unchecked ( i1) )
20
+ #[ cfg( not( feature = "debug" ) ) ]
21
+ fn validate_inputs_internal ( i1 : I1 ) -> Result < ( ) , InputError > {
22
+ Self :: validate_inputs ( i1)
34
23
}
35
24
36
25
#[ cfg( feature = "debug" ) ]
37
26
#[ cfg( debug_assertions) ]
38
- #[ inline( always ) ]
27
+ #[ inline]
39
28
#[ allow( missing_docs) ]
40
29
#[ allow( clippy:: missing_errors_doc) ]
41
- fn validate_inputs_loggerr ( i1 : I1 ) -> Result < ( ) , InputError > {
30
+ fn validate_inputs_internal ( i1 : I1 ) -> Result < ( ) , InputError > {
42
31
use std:: any:: type_name;
43
32
44
33
Self :: validate_inputs ( i1) . or_else ( |err| {
@@ -53,6 +42,14 @@ pub trait Formula1<O: ThermodynamicQuantity, I1: ThermodynamicQuantity> {
53
42
} )
54
43
}
55
44
45
+ #[ allow( clippy:: missing_errors_doc) ]
46
+ #[ allow( missing_docs) ]
47
+ #[ inline]
48
+ fn compute ( i1 : I1 ) -> Result < O , InputError > {
49
+ Self :: validate_inputs_internal ( i1) ?;
50
+ Ok ( Self :: compute_unchecked ( i1) )
51
+ }
52
+
56
53
#[ allow( missing_docs) ]
57
54
#[ allow( clippy:: missing_errors_doc) ]
58
55
fn compute_vec ( i1 : & [ I1 ] ) -> Result < Vec < O > , InputError > {
@@ -71,7 +68,7 @@ pub trait Formula1<O: ThermodynamicQuantity, I1: ThermodynamicQuantity> {
71
68
let i1: ArrayView < I1 , D > = i1. into ( ) ;
72
69
73
70
Zip :: from ( i1)
74
- . fold_while ( Ok ( ( ) ) , |_, & i1| match Self :: validate_inputs ( i1) {
71
+ . fold_while ( Ok ( ( ) ) , |_, & i1| match Self :: validate_inputs_internal ( i1) {
75
72
Ok ( _) => FoldWhile :: Continue ( Ok ( ( ) ) ) ,
76
73
Err ( e) => FoldWhile :: Done ( Err ( e) ) ,
77
74
} )
@@ -99,7 +96,7 @@ pub trait Formula1<O: ThermodynamicQuantity, I1: ThermodynamicQuantity> {
99
96
let i1: ArrayView < I1 , D > = i1. into ( ) ;
100
97
101
98
Zip :: from ( i1)
102
- . fold_while ( Ok ( ( ) ) , |_, & a| match Self :: validate_inputs ( a) {
99
+ . fold_while ( Ok ( ( ) ) , |_, & a| match Self :: validate_inputs_internal ( a) {
103
100
Ok ( _) => FoldWhile :: Continue ( Ok ( ( ) ) ) ,
104
101
Err ( e) => FoldWhile :: Done ( Err ( e) ) ,
105
102
} )
@@ -117,31 +114,20 @@ pub trait Formula2<O: ThermodynamicQuantity, I1: ThermodynamicQuantity, I2: Ther
117
114
#[ allow( clippy:: missing_errors_doc) ]
118
115
fn validate_inputs ( i1 : I1 , i2 : I2 ) -> Result < ( ) , InputError > ;
119
116
120
- #[ allow( clippy:: missing_errors_doc) ]
121
117
#[ allow( missing_docs) ]
118
+ #[ allow( clippy:: missing_errors_doc) ]
122
119
#[ inline]
123
- fn compute ( i1 : I1 , i2 : I2 ) -> Result < O , InputError > {
124
- cfg_if:: cfg_if! {
125
- if #[ cfg( feature = "debug" ) ] {
126
- cfg_if:: cfg_if! {
127
- if #[ cfg( debug_assertions) ] {
128
- Self :: validate_inputs_loggerr( i1, i2) ?;
129
- }
130
- }
131
- } else {
132
- Self :: validate_inputs( i1, i2) ?;
133
- }
134
- }
135
-
136
- Ok ( Self :: compute_unchecked ( i1, i2) )
120
+ #[ cfg( not( feature = "debug" ) ) ]
121
+ fn validate_inputs_internal ( i1 : I1 , i2 : I2 ) -> Result < ( ) , InputError > {
122
+ Self :: validate_inputs ( i1, i2)
137
123
}
138
124
139
125
#[ cfg( feature = "debug" ) ]
140
126
#[ cfg( debug_assertions) ]
141
- #[ inline( always ) ]
127
+ #[ inline]
142
128
#[ allow( missing_docs) ]
143
129
#[ allow( clippy:: missing_errors_doc) ]
144
- fn validate_inputs_loggerr ( i1 : I1 , i2 : I2 ) -> Result < ( ) , InputError > {
130
+ fn validate_inputs_internal ( i1 : I1 , i2 : I2 ) -> Result < ( ) , InputError > {
145
131
use std:: any:: type_name;
146
132
147
133
Self :: validate_inputs ( i1, i2) . or_else ( |err| {
@@ -157,6 +143,14 @@ pub trait Formula2<O: ThermodynamicQuantity, I1: ThermodynamicQuantity, I2: Ther
157
143
} )
158
144
}
159
145
146
+ #[ allow( clippy:: missing_errors_doc) ]
147
+ #[ allow( missing_docs) ]
148
+ #[ inline]
149
+ fn compute ( i1 : I1 , i2 : I2 ) -> Result < O , InputError > {
150
+ Self :: validate_inputs_internal ( i1, i2) ?;
151
+ Ok ( Self :: compute_unchecked ( i1, i2) )
152
+ }
153
+
160
154
#[ allow( missing_docs) ]
161
155
#[ allow( clippy:: missing_errors_doc) ]
162
156
fn compute_vec ( i1 : & [ I1 ] , i2 : & [ I2 ] ) -> Result < Vec < O > , InputError > {
@@ -187,9 +181,11 @@ pub trait Formula2<O: ThermodynamicQuantity, I1: ThermodynamicQuantity, I2: Ther
187
181
188
182
Zip :: from ( i1)
189
183
. and ( i2)
190
- . fold_while ( Ok ( ( ) ) , |_, & i1, & i2| match Self :: validate_inputs ( i1, i2) {
191
- Ok ( _) => FoldWhile :: Continue ( Ok ( ( ) ) ) ,
192
- Err ( e) => FoldWhile :: Done ( Err ( e) ) ,
184
+ . fold_while ( Ok ( ( ) ) , |_, & i1, & i2| {
185
+ match Self :: validate_inputs_internal ( i1, i2) {
186
+ Ok ( _) => FoldWhile :: Continue ( Ok ( ( ) ) ) ,
187
+ Err ( e) => FoldWhile :: Done ( Err ( e) ) ,
188
+ }
193
189
} )
194
190
. into_inner ( ) ?;
195
191
@@ -229,9 +225,11 @@ pub trait Formula2<O: ThermodynamicQuantity, I1: ThermodynamicQuantity, I2: Ther
229
225
230
226
Zip :: from ( i1)
231
227
. and ( i2)
232
- . fold_while ( Ok ( ( ) ) , |_, & i1, & i2| match Self :: validate_inputs ( i1, i2) {
233
- Ok ( _) => FoldWhile :: Continue ( Ok ( ( ) ) ) ,
234
- Err ( e) => FoldWhile :: Done ( Err ( e) ) ,
228
+ . fold_while ( Ok ( ( ) ) , |_, & i1, & i2| {
229
+ match Self :: validate_inputs_internal ( i1, i2) {
230
+ Ok ( _) => FoldWhile :: Continue ( Ok ( ( ) ) ) ,
231
+ Err ( e) => FoldWhile :: Done ( Err ( e) ) ,
232
+ }
235
233
} )
236
234
. into_inner ( ) ?;
237
235
@@ -255,31 +253,20 @@ pub trait Formula3<
255
253
#[ allow( clippy:: missing_errors_doc) ]
256
254
fn validate_inputs ( i1 : I1 , i2 : I2 , i3 : I3 ) -> Result < ( ) , InputError > ;
257
255
258
- #[ allow( clippy:: missing_errors_doc) ]
259
256
#[ allow( missing_docs) ]
257
+ #[ allow( clippy:: missing_errors_doc) ]
260
258
#[ inline]
261
- fn compute ( i1 : I1 , i2 : I2 , i3 : I3 ) -> Result < O , InputError > {
262
- cfg_if:: cfg_if! {
263
- if #[ cfg( feature = "debug" ) ] {
264
- cfg_if:: cfg_if! {
265
- if #[ cfg( debug_assertions) ] {
266
- Self :: validate_inputs_loggerr( i1, i2, i3) ?;
267
- }
268
- }
269
- } else {
270
- Self :: validate_inputs( i1, i2, i3) ?;
271
- }
272
- }
273
-
274
- Ok ( Self :: compute_unchecked ( i1, i2, i3) )
259
+ #[ cfg( not( feature = "debug" ) ) ]
260
+ fn validate_inputs_internal ( i1 : I1 , i2 : I2 , i3 : I3 ) -> Result < ( ) , InputError > {
261
+ Self :: validate_inputs ( i1, i2, i3)
275
262
}
276
263
277
264
#[ cfg( feature = "debug" ) ]
278
265
#[ cfg( debug_assertions) ]
279
- #[ inline( always ) ]
266
+ #[ inline]
280
267
#[ allow( missing_docs) ]
281
268
#[ allow( clippy:: missing_errors_doc) ]
282
- fn validate_inputs_loggerr ( i1 : I1 , i2 : I2 , i3 : I3 ) -> Result < ( ) , InputError > {
269
+ fn validate_inputs_internal ( i1 : I1 , i2 : I2 , i3 : I3 ) -> Result < ( ) , InputError > {
283
270
use std:: any:: type_name;
284
271
285
272
Self :: validate_inputs ( i1, i2, i3) . or_else ( |err| {
@@ -296,6 +283,14 @@ pub trait Formula3<
296
283
} )
297
284
}
298
285
286
+ #[ allow( clippy:: missing_errors_doc) ]
287
+ #[ allow( missing_docs) ]
288
+ #[ inline]
289
+ fn compute ( i1 : I1 , i2 : I2 , i3 : I3 ) -> Result < O , InputError > {
290
+ Self :: validate_inputs_internal ( i1, i2, i3) ?;
291
+ Ok ( Self :: compute_unchecked ( i1, i2, i3) )
292
+ }
293
+
299
294
#[ allow( missing_docs) ]
300
295
#[ allow( clippy:: missing_errors_doc) ]
301
296
fn compute_vec ( i1 : & [ I1 ] , i2 : & [ I2 ] , i3 : & [ I3 ] ) -> Result < Vec < O > , InputError > {
@@ -332,12 +327,13 @@ pub trait Formula3<
332
327
Zip :: from ( i1)
333
328
. and ( i2)
334
329
. and ( i3)
335
- . fold_while ( Ok ( ( ) ) , |_, & i1, & i2, & i3| {
336
- match Self :: validate_inputs ( i1, i2, i3) {
330
+ . fold_while (
331
+ Ok ( ( ) ) ,
332
+ |_, & i1, & i2, & i3| match Self :: validate_inputs_internal ( i1, i2, i3) {
337
333
Ok ( _) => FoldWhile :: Continue ( Ok ( ( ) ) ) ,
338
334
Err ( e) => FoldWhile :: Done ( Err ( e) ) ,
339
- }
340
- } )
335
+ } ,
336
+ )
341
337
. into_inner ( ) ?;
342
338
343
339
Ok ( Zip :: from ( i1)
@@ -383,12 +379,13 @@ pub trait Formula3<
383
379
Zip :: from ( i1)
384
380
. and ( i2)
385
381
. and ( i3)
386
- . fold_while ( Ok ( ( ) ) , |_, & i1, & i2, & i3| {
387
- match Self :: validate_inputs ( i1, i2, i3) {
382
+ . fold_while (
383
+ Ok ( ( ) ) ,
384
+ |_, & i1, & i2, & i3| match Self :: validate_inputs_internal ( i1, i2, i3) {
388
385
Ok ( _) => FoldWhile :: Continue ( Ok ( ( ) ) ) ,
389
386
Err ( e) => FoldWhile :: Done ( Err ( e) ) ,
390
- }
391
- } )
387
+ } ,
388
+ )
392
389
. into_inner ( ) ?;
393
390
394
391
Ok ( Zip :: from ( i1)
@@ -413,31 +410,28 @@ pub trait Formula4<
413
410
#[ allow( clippy:: missing_errors_doc) ]
414
411
fn validate_inputs ( i1 : I1 , i2 : I2 , i3 : I3 , i4 : I4 ) -> Result < ( ) , InputError > ;
415
412
413
+ #[ allow( missing_docs) ]
414
+ #[ allow( clippy:: missing_errors_doc) ]
415
+ #[ inline]
416
+ #[ cfg( not( feature = "debug" ) ) ]
417
+ fn validate_inputs_internal ( i1 : I1 , i2 : I2 , i3 : I3 , i4 : I4 ) -> Result < ( ) , InputError > {
418
+ Self :: validate_inputs ( i1, i2, i3, i4)
419
+ }
420
+
416
421
#[ allow( clippy:: missing_errors_doc) ]
417
422
#[ allow( missing_docs) ]
418
423
#[ inline]
419
424
fn compute ( i1 : I1 , i2 : I2 , i3 : I3 , i4 : I4 ) -> Result < O , InputError > {
420
- cfg_if:: cfg_if! {
421
- if #[ cfg( feature = "debug" ) ] {
422
- cfg_if:: cfg_if! {
423
- if #[ cfg( debug_assertions) ] {
424
- Self :: validate_inputs_loggerr( i1, i2, i3, i4) ?;
425
- }
426
- }
427
- } else {
428
- Self :: validate_inputs( i1, i2, i3, i4) ?;
429
- }
430
- }
431
-
425
+ Self :: validate_inputs_internal ( i1, i2, i3, i4) ?;
432
426
Ok ( Self :: compute_unchecked ( i1, i2, i3, i4) )
433
427
}
434
428
435
429
#[ cfg( feature = "debug" ) ]
436
430
#[ cfg( debug_assertions) ]
437
- #[ inline( always ) ]
431
+ #[ inline]
438
432
#[ allow( missing_docs) ]
439
433
#[ allow( clippy:: missing_errors_doc) ]
440
- fn validate_inputs_loggerr ( i1 : I1 , i2 : I2 , i3 : I3 , i4 : I4 ) -> Result < ( ) , InputError > {
434
+ fn validate_inputs_internal ( i1 : I1 , i2 : I2 , i3 : I3 , i4 : I4 ) -> Result < ( ) , InputError > {
441
435
use std:: any:: type_name;
442
436
443
437
Self :: validate_inputs ( i1, i2, i3, i4) . or_else ( |err| {
@@ -499,7 +493,7 @@ pub trait Formula4<
499
493
. and ( i4)
500
494
. fold_while (
501
495
Ok ( ( ) ) ,
502
- |_, & i1, & i2, & i3, & i4| match Self :: validate_inputs ( i1, i2, i3, i4) {
496
+ |_, & i1, & i2, & i3, & i4| match Self :: validate_inputs_internal ( i1, i2, i3, i4) {
503
497
Ok ( _) => FoldWhile :: Continue ( Ok ( ( ) ) ) ,
504
498
Err ( e) => FoldWhile :: Done ( Err ( e) ) ,
505
499
} ,
@@ -563,7 +557,7 @@ pub trait Formula4<
563
557
. and ( i4)
564
558
. fold_while (
565
559
Ok ( ( ) ) ,
566
- |_, & i1, & i2, & i3, & i4| match Self :: validate_inputs ( i1, i2, i3, i4) {
560
+ |_, & i1, & i2, & i3, & i4| match Self :: validate_inputs_internal ( i1, i2, i3, i4) {
567
561
Ok ( _) => FoldWhile :: Continue ( Ok ( ( ) ) ) ,
568
562
Err ( e) => FoldWhile :: Done ( Err ( e) ) ,
569
563
} ,
0 commit comments