@@ -137,56 +137,22 @@ struct LocalUseMapBuild<'me> {
137
137
locals_with_use_data : IndexVec < Local , bool > ,
138
138
}
139
139
140
- impl LocalUseMapBuild < ' _ > {
141
- fn insert_def ( & mut self , local : Local , location : Location ) {
142
- Self :: insert (
143
- self . elements ,
144
- & mut self . local_use_map . first_def_at [ local] ,
145
- & mut self . local_use_map . appearances ,
146
- location,
147
- ) ;
148
- }
149
-
150
- fn insert_use ( & mut self , local : Local , location : Location ) {
151
- Self :: insert (
152
- self . elements ,
153
- & mut self . local_use_map . first_use_at [ local] ,
154
- & mut self . local_use_map . appearances ,
155
- location,
156
- ) ;
157
- }
158
-
159
- fn insert_drop ( & mut self , local : Local , location : Location ) {
160
- Self :: insert (
161
- self . elements ,
162
- & mut self . local_use_map . first_drop_at [ local] ,
163
- & mut self . local_use_map . appearances ,
164
- location,
165
- ) ;
166
- }
167
-
168
- fn insert (
169
- elements : & DenseLocationMap ,
170
- first_appearance : & mut Option < AppearanceIndex > ,
171
- appearances : & mut Appearances ,
172
- location : Location ,
173
- ) {
174
- let point_index = elements. point_from_location ( location) ;
175
- let appearance_index =
176
- appearances. push ( Appearance { point_index, next : * first_appearance } ) ;
177
- * first_appearance = Some ( appearance_index) ;
178
- }
179
- }
180
-
181
140
impl Visitor < ' _ > for LocalUseMapBuild < ' _ > {
182
141
fn visit_local ( & mut self , local : Local , context : PlaceContext , location : Location ) {
183
- if self . locals_with_use_data [ local] {
184
- match def_use:: categorize ( context) {
185
- Some ( DefUse :: Def ) => self . insert_def ( local, location) ,
186
- Some ( DefUse :: Use ) => self . insert_use ( local, location) ,
187
- Some ( DefUse :: Drop ) => self . insert_drop ( local, location) ,
188
- _ => ( ) ,
189
- }
142
+ if self . locals_with_use_data [ local]
143
+ && let Some ( def_use) = def_use:: categorize ( context)
144
+ {
145
+ let first_appearance = match def_use {
146
+ DefUse :: Def => & mut self . local_use_map . first_def_at [ local] ,
147
+ DefUse :: Use => & mut self . local_use_map . first_use_at [ local] ,
148
+ DefUse :: Drop => & mut self . local_use_map . first_drop_at [ local] ,
149
+ } ;
150
+ let point_index = self . elements . point_from_location ( location) ;
151
+ let appearance_index = self
152
+ . local_use_map
153
+ . appearances
154
+ . push ( Appearance { point_index, next : * first_appearance } ) ;
155
+ * first_appearance = Some ( appearance_index) ;
190
156
}
191
157
}
192
158
}
0 commit comments