@@ -17,6 +17,7 @@ use std::collections::{HashMap, HashSet};
17
17
use std:: error:: Error ;
18
18
use std:: hash:: Hash ;
19
19
use std:: sync:: Arc ;
20
+ use std:: fmt:: Write ;
20
21
21
22
type BoxedError = Box < dyn Error + Send + Sync > ;
22
23
@@ -388,7 +389,6 @@ async fn write_triage_summary(
388
389
primary : & ArtifactComparisonSummary ,
389
390
secondary : & ArtifactComparisonSummary ,
390
391
) -> String {
391
- use std:: fmt:: Write ;
392
392
let mut result = if let Some ( pr) = comparison. b . pr {
393
393
let title = github:: pr_title ( pr) . await ;
394
394
format ! (
@@ -415,8 +415,6 @@ pub fn write_summary_table(
415
415
with_footnotes : bool ,
416
416
result : & mut String ,
417
417
) {
418
- use std:: fmt:: Write ;
419
-
420
418
fn render_stat < F : FnOnce ( ) -> Option < f64 > > ( count : usize , calculate : F ) -> String {
421
419
let value = if count > 0 { calculate ( ) } else { None } ;
422
420
value
@@ -538,16 +536,16 @@ pub fn write_summary_table(
538
536
} ) ,
539
537
largest_change,
540
538
] ) ;
539
+ }
541
540
542
- if with_footnotes {
543
- writeln ! (
544
- result,
545
- r#"
541
+ pub fn write_summary_table_footer ( result : & mut String ) {
542
+ writeln ! (
543
+ result,
544
+ r#"
546
545
[^1]: *number of relevant changes*
547
546
[^2]: *the arithmetic mean of the percent change*"#
548
- )
547
+ )
549
548
. unwrap ( ) ;
550
- }
551
549
}
552
550
553
551
/// Compare two bounds on a given stat
@@ -1272,9 +1270,6 @@ mod tests {
1272
1270
| count[^1] | 3 | 0 | 0 | 0 | 3 |
1273
1271
| mean[^2] | 146.7% | N/A | N/A | N/A | 146.7% |
1274
1272
| max | 200.0% | N/A | N/A | N/A | 200.0% |
1275
-
1276
- [^1]: *number of relevant changes*
1277
- [^2]: *the arithmetic mean of the percent change*
1278
1273
"#
1279
1274
. trim_start ( ) ,
1280
1275
) ;
@@ -1294,9 +1289,6 @@ mod tests {
1294
1289
| count[^1] | 0 | 0 | 3 | 0 | 3 |
1295
1290
| mean[^2] | N/A | N/A | -71.7% | N/A | -71.7% |
1296
1291
| max | N/A | N/A | -80.0% | N/A | -80.0% |
1297
-
1298
- [^1]: *number of relevant changes*
1299
- [^2]: *the arithmetic mean of the percent change*
1300
1292
"#
1301
1293
. trim_start ( ) ,
1302
1294
) ;
@@ -1316,9 +1308,6 @@ mod tests {
1316
1308
| count[^1] | 0 | 0 | 0 | 3 | 0 |
1317
1309
| mean[^2] | N/A | N/A | N/A | -71.7% | N/A |
1318
1310
| max | N/A | N/A | N/A | -80.0% | N/A |
1319
-
1320
- [^1]: *number of relevant changes*
1321
- [^2]: *the arithmetic mean of the percent change*
1322
1311
"#
1323
1312
. trim_start ( ) ,
1324
1313
) ;
@@ -1338,9 +1327,6 @@ mod tests {
1338
1327
| count[^1] | 0 | 3 | 0 | 0 | 0 |
1339
1328
| mean[^2] | N/A | 146.7% | N/A | N/A | N/A |
1340
1329
| max | N/A | 200.0% | N/A | N/A | N/A |
1341
-
1342
- [^1]: *number of relevant changes*
1343
- [^2]: *the arithmetic mean of the percent change*
1344
1330
"#
1345
1331
. trim_start ( ) ,
1346
1332
) ;
@@ -1361,9 +1347,6 @@ mod tests {
1361
1347
| count[^1] | 2 | 0 | 2 | 0 | 4 |
1362
1348
| mean[^2] | 150.0% | N/A | -62.5% | N/A | 43.8% |
1363
1349
| max | 200.0% | N/A | -75.0% | N/A | 200.0% |
1364
-
1365
- [^1]: *number of relevant changes*
1366
- [^2]: *the arithmetic mean of the percent change*
1367
1350
"#
1368
1351
. trim_start ( ) ,
1369
1352
) ;
@@ -1386,9 +1369,6 @@ mod tests {
1386
1369
| count[^1] | 2 | 1 | 2 | 1 | 4 |
1387
1370
| mean[^2] | 150.0% | 100.0% | -62.5% | -66.7% | 43.8% |
1388
1371
| max | 200.0% | 100.0% | -75.0% | -66.7% | 200.0% |
1389
-
1390
- [^1]: *number of relevant changes*
1391
- [^2]: *the arithmetic mean of the percent change*
1392
1372
"#
1393
1373
. trim_start ( ) ,
1394
1374
) ;
@@ -1407,9 +1387,6 @@ mod tests {
1407
1387
| count[^1] | 1 | 0 | 1 | 0 | 2 |
1408
1388
| mean[^2] | 20.0% | N/A | -50.0% | N/A | -15.0% |
1409
1389
| max | 20.0% | N/A | -50.0% | N/A | -50.0% |
1410
-
1411
- [^1]: *number of relevant changes*
1412
- [^2]: *the arithmetic mean of the percent change*
1413
1390
"#
1414
1391
. trim_start ( ) ,
1415
1392
) ;
@@ -1428,9 +1405,6 @@ mod tests {
1428
1405
| count[^1] | 1 | 0 | 1 | 0 | 2 |
1429
1406
| mean[^2] | 100.0% | N/A | -16.7% | N/A | 41.7% |
1430
1407
| max | 100.0% | N/A | -16.7% | N/A | 100.0% |
1431
-
1432
- [^1]: *number of relevant changes*
1433
- [^2]: *the arithmetic mean of the percent change*
1434
1408
"#
1435
1409
. trim_start ( ) ,
1436
1410
) ;
0 commit comments