From ee1f901b9a0b0cdb7f3ca4fd7cceee0da7144df3 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Mon, 4 Mar 2019 13:26:52 +0100 Subject: openpgp: Only print signature stats if we saw some. --- openpgp/examples/statistics.rs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'openpgp/examples/statistics.rs') diff --git a/openpgp/examples/statistics.rs b/openpgp/examples/statistics.rs index c1c3c33a..c5749621 100644 --- a/openpgp/examples/statistics.rs +++ b/openpgp/examples/statistics.rs @@ -155,19 +155,21 @@ fn main() { tags_size_bytes[t]); } } - println!(); - println!("# Signature statistics"); - println!(); - println!("{:>22} {:>9}", - "", "count",); - println!("--------------------------------"); - for t in 0..256 { - let max = tpk_max.sigs[t]; - if max > 0 { - println!("{:>22} {:>9}", - format!("{:?}", SignatureType::from(t as u8)), - sigs_count[t]); + if tags_count[u8::from(Tag::Signature) as usize] > 0 { + println!(); + println!("# Signature statistics"); + println!(); + println!("{:>22} {:>9}", + "", "count",); + println!("--------------------------------"); + for t in 0..256 { + let max = tpk_max.sigs[t]; + if max > 0 { + println!("{:>22} {:>9}", + format!("{:?}", SignatureType::from(t as u8)), + sigs_count[t]); + } } } -- cgit v1.2.3