@@ -229,12 +229,11 @@ impl CrateDefMap {
229
229
// even), as this should be a great debugging aid.
230
230
pub fn dump ( & self ) -> String {
231
231
let mut buf = String :: new ( ) ;
232
- go ( & mut buf, self , "\n crate " , self . root ) ;
233
- return buf. trim ( ) . to_string ( ) ;
232
+ go ( & mut buf, self , "crate " , self . root ) ;
233
+ return buf;
234
234
235
235
fn go ( buf : & mut String , map : & CrateDefMap , path : & str , module : LocalModuleId ) {
236
- * buf += path;
237
- * buf += "\n " ;
236
+ format_to ! ( buf, "{}\n " , path) ;
238
237
239
238
let mut entries: Vec < _ > = map. modules [ module] . scope . resolutions ( ) . collect ( ) ;
240
239
entries. sort_by_key ( |( name, _) | name. clone ( ) ) ;
@@ -243,23 +242,24 @@ impl CrateDefMap {
243
242
format_to ! ( buf, "{}:" , name) ;
244
243
245
244
if def. types . is_some ( ) {
246
- * buf += " t" ;
245
+ buf. push_str ( " t" ) ;
247
246
}
248
247
if def. values . is_some ( ) {
249
- * buf += " v" ;
248
+ buf. push_str ( " v" ) ;
250
249
}
251
250
if def. macros . is_some ( ) {
252
- * buf += " m" ;
251
+ buf. push_str ( " m" ) ;
253
252
}
254
253
if def. is_none ( ) {
255
- * buf += " _" ;
254
+ buf. push_str ( " _" ) ;
256
255
}
257
256
258
- * buf += "\n " ;
257
+ buf. push_str ( "\n " ) ;
259
258
}
260
259
261
260
for ( name, child) in map. modules [ module] . children . iter ( ) {
262
- let path = & format ! ( "{}::{}" , path, name) ;
261
+ let path = format ! ( "{}::{}" , path, name) ;
262
+ buf. push ( '\n' ) ;
263
263
go ( buf, map, & path, * child) ;
264
264
}
265
265
}
0 commit comments