From 8aa6c72ca93636c5aeeda9d95d308ba2b2fc700a Mon Sep 17 00:00:00 2001 From: Antoine Marras <57460188+spineki@users.noreply.github.com> Date: Sun, 20 Nov 2022 22:07:33 +0100 Subject: [PATCH] Do not show the "-n option" if there is nothing more to display. --- src/main.rs | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3ab9974..561d331 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1234,13 +1234,15 @@ fn print_methods_table(methods: Methods, data: &Data, term_width: Option) data.symbols.len() - methods.methods.len() }; - table.push(&[ - format_percent(methods.filter_out_size as f64 / data.file_size as f64 * 100.0), - format_percent(methods.filter_out_size as f64 / data.text_size as f64 * 100.0), - format_size(methods.filter_out_size), - String::new(), - format!("And {} smaller methods. Use -n N to show more.", others_count), - ]); + if others_count != 0 { + table.push(&[ + format_percent(methods.filter_out_size as f64 / data.file_size as f64 * 100.0), + format_percent(methods.filter_out_size as f64 / data.text_size as f64 * 100.0), + format_size(methods.filter_out_size), + String::new(), + format!("And {} smaller methods. Use -n N to show more.", others_count), + ]); + } } if methods.has_filter { @@ -1285,11 +1287,13 @@ fn print_methods_table_no_relative(methods: Methods, data: &Data, term_width: Op data.symbols.len() - methods.methods.len() }; - table.push(&[ - format_size(methods.filter_out_size), - String::new(), - format!("And {} smaller methods. Use -n N to show more.", others_count), - ]); + if others_count != 0 { + table.push(&[ + format_size(methods.filter_out_size), + String::new(), + format!("And {} smaller methods. Use -n N to show more.", others_count), + ]); + } } if methods.has_filter {