Skip to content

Commit

Permalink
Do not show the "-n option" if there is nothing more to display.
Browse files Browse the repository at this point in the history
  • Loading branch information
spineki authored Nov 20, 2022
1 parent a413f29 commit 8aa6c72
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1234,13 +1234,15 @@ fn print_methods_table(methods: Methods, data: &Data, term_width: Option<usize>)
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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 8aa6c72

Please sign in to comment.