@@ -128,19 +128,11 @@ fn process_monomorphizations(monos_map: MonosMap, opts: &opt::Monos) -> Vec<Mono
128
128
monos
129
129
}
130
130
131
- /// Find bloaty monomorphizations of generic functions.
132
- pub fn monos (
133
- items : & mut ir:: Items ,
134
- opts : & opt:: Monos ,
135
- ) -> Result < Box < dyn traits:: Emit > , traits:: Error > {
136
- // Collect the options that will be needed.
131
+ /// Adds entries to summarize remaining rows that will be truncated, and
132
+ /// totals for the entire set of monomorphizations.
133
+ fn add_stats ( mut monos : Vec < MonosEntry > , opts : & opt:: Monos ) -> Vec < MonosEntry > {
137
134
let max_generics = opts. max_generics ( ) as usize ;
138
135
139
- // Collect the monomorphizations of generic functions into a map, then
140
- // process the entries and sort the resulting vector.
141
- let monos_map = collect_monomorphizations ( & items) ;
142
- let mut monos = process_monomorphizations ( monos_map, & opts) ;
143
-
144
136
// Create an entry to represent the remaining rows that will be truncated.
145
137
let ( rem_cnt, rem_size, rem_savings) = summarize_entries ( monos. iter ( ) . skip ( max_generics) ) ;
146
138
let remaining = MonosEntry {
@@ -165,5 +157,16 @@ pub fn monos(
165
157
monos. push ( remaining) ;
166
158
}
167
159
monos. push ( total) ;
160
+ monos
161
+ }
162
+
163
+ /// Find bloaty monomorphizations of generic functions.
164
+ pub fn monos (
165
+ items : & mut ir:: Items ,
166
+ opts : & opt:: Monos ,
167
+ ) -> Result < Box < dyn traits:: Emit > , traits:: Error > {
168
+ let monos_map = collect_monomorphizations ( & items) ;
169
+ let mut monos = process_monomorphizations ( monos_map, & opts) ;
170
+ monos = add_stats ( monos, & opts) ;
168
171
Ok ( Box :: new ( Monos { monos } ) as Box < _ > )
169
172
}
0 commit comments