@@ -206,9 +206,9 @@ impl<'a, I: FileOrInlineOrigin, T: FileContents> ItemCache<'a, I, T> {
206206 }
207207 }
208208
209- pub fn get_string ( & mut self , index : u32 ) -> Result < String , Error > {
209+ pub fn get_string ( & mut self , index : u32 ) -> Result < & ' a str , Error > {
210210 match self . item_strings . entry ( index) {
211- Entry :: Occupied ( name) => Ok ( name. get ( ) . to_string ( ) ) ,
211+ Entry :: Occupied ( name) => Ok ( name. get ( ) ) ,
212212 Entry :: Vacant ( vacant) => {
213213 let entry = self
214214 . item_map
@@ -226,7 +226,7 @@ impl<'a, I: FileOrInlineOrigin, T: FileContents> ItemCache<'a, I, T> {
226226 )
227227 } ) ?;
228228 let s = I :: parse ( line) ?;
229- Ok ( vacant. insert ( s) . to_string ( ) )
229+ Ok ( vacant. insert ( s) )
230230 }
231231 }
232232 }
@@ -331,12 +331,13 @@ impl<T: FileContents> SymbolMapTrait for BreakpadSymbolMapInner<'_, T> {
331331
332332 let mut frames = Vec :: new ( ) ;
333333 let mut depth = 0 ;
334- let mut name = Some ( info. name . to_string ( ) ) ;
334+ let mut name = Some ( info. name ) ;
335335 while let Some ( inlinee) = info. get_inlinee_at_depth ( depth, address) {
336336 let file = files. get_string ( inlinee. call_file ) . ok ( ) ;
337337 frames. push ( FrameDebugInfo {
338- function : name,
339- file_path : file. map ( SourceFilePath :: BreakpadSpecialPathStr ) ,
338+ function : name. map ( ToString :: to_string) ,
339+ file_path : file
340+ . map ( |f| SourceFilePath :: BreakpadSpecialPathStr ( f. to_string ( ) ) ) ,
340341 line_number : Some ( inlinee. call_line ) ,
341342 } ) ;
342343 let inline_origin = inline_origins. get_string ( inlinee. origin_id ) . ok ( ) ;
@@ -351,8 +352,8 @@ impl<T: FileContents> SymbolMapTrait for BreakpadSymbolMapInner<'_, T> {
351352 ( None , None )
352353 } ;
353354 frames. push ( FrameDebugInfo {
354- function : name,
355- file_path : file. map ( SourceFilePath :: BreakpadSpecialPathStr ) ,
355+ function : name. map ( ToString :: to_string ) ,
356+ file_path : file. map ( |f| SourceFilePath :: BreakpadSpecialPathStr ( f . to_string ( ) ) ) ,
356357 line_number,
357358 } ) ;
358359 frames. reverse ( ) ;
0 commit comments