@@ -133,27 +133,37 @@ fn process_monomorphizations(monos_map: MonosMap, opts: &opt::Monos) -> Vec<Mono
133
133
fn add_stats ( mut monos : Vec < MonosEntry > , opts : & opt:: Monos ) -> Vec < MonosEntry > {
134
134
let max_generics = opts. max_generics ( ) as usize ;
135
135
136
- // Create an entry to represent the remaining rows that will be truncated.
137
- let ( rem_cnt, rem_size, rem_savings) = summarize_entries ( monos. iter ( ) . skip ( max_generics) ) ;
138
- let remaining = MonosEntry {
139
- name : format ! ( "... and {} more." , rem_cnt) ,
140
- size : rem_size,
141
- insts : vec ! [ ] ,
142
- bloat : rem_savings,
136
+ // Create an entry to represent the remaining rows that will be truncated,
137
+ // only if there are more generics than we will display.
138
+ let remaining: Option < MonosEntry > = {
139
+ if monos. len ( ) > max_generics {
140
+ let ( rem_cnt, rem_size, rem_savings) =
141
+ summarize_entries ( monos. iter ( ) . skip ( max_generics) ) ;
142
+ Some ( MonosEntry {
143
+ name : format ! ( "... and {} more." , rem_cnt) ,
144
+ size : rem_size,
145
+ insts : vec ! [ ] ,
146
+ bloat : rem_savings,
147
+ } )
148
+ } else {
149
+ None
150
+ }
143
151
} ;
144
152
145
153
// Create an entry to represent the 'total' summary.
146
- let ( total_cnt, total_size, total_savings) = summarize_entries ( monos. iter ( ) ) ;
147
- let total = MonosEntry {
148
- name : format ! ( "Σ [{} Total Rows]" , total_cnt) ,
149
- size : total_size,
150
- insts : vec ! [ ] ,
151
- bloat : total_savings,
154
+ let total = {
155
+ let ( total_cnt, total_size, total_savings) = summarize_entries ( monos. iter ( ) ) ;
156
+ MonosEntry {
157
+ name : format ! ( "Σ [{} Total Rows]" , total_cnt) ,
158
+ size : total_size,
159
+ insts : vec ! [ ] ,
160
+ bloat : total_savings,
161
+ }
152
162
} ;
153
163
154
164
// Truncate the vector, and add the 'remaining' and 'total' summary entries.
155
165
monos. truncate ( max_generics) ;
156
- if rem_cnt > 0 {
166
+ if let Some ( remaining ) = remaining {
157
167
monos. push ( remaining) ;
158
168
}
159
169
monos. push ( total) ;
0 commit comments