@@ -35,7 +35,7 @@ pub struct Visibility {
3535 pub telemetry : bool ,
3636}
3737
38- #[ derive( Serialize ) ]
38+ #[ derive( Serialize , Clone ) ]
3939#[ serde( rename_all = "camelCase" ) ]
4040pub struct Location {
4141 #[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -176,7 +176,7 @@ impl DiagnosticLoggers {
176176 source : Source {
177177 id : id. to_owned ( ) ,
178178 name : name. to_owned ( ) ,
179- extractor_name : Some ( self . extractor ) ,
179+ extractor_name : Some ( self . extractor . to_owned ( ) ) ,
180180 } ,
181181 markdown_message : String :: new ( ) ,
182182 plaintext_message : String :: new ( ) ,
@@ -233,23 +233,31 @@ impl DiagnosticMessage {
233233 self
234234 }
235235 pub fn file < ' a > ( & ' a mut self , path : & str ) -> & ' a mut Self {
236- self . location . get_or_insert ( EMPTY_LOCATION ) . file = Some ( path. to_owned ( ) ) ;
236+ self . location . get_or_insert ( EMPTY_LOCATION . to_owned ( ) ) . file = Some ( path. to_owned ( ) ) ;
237237 self
238238 }
239239 pub fn start_line < ' a > ( & ' a mut self , start_line : i32 ) -> & ' a mut Self {
240- self . location . get_or_insert ( EMPTY_LOCATION ) . start_line = Some ( start_line) ;
240+ self . location
241+ . get_or_insert ( EMPTY_LOCATION . to_owned ( ) )
242+ . start_line = Some ( start_line) ;
241243 self
242244 }
243245 pub fn start_column < ' a > ( & ' a mut self , start_column : i32 ) -> & ' a mut Self {
244- self . location . get_or_insert ( EMPTY_LOCATION ) . start_column = Some ( start_column) ;
246+ self . location
247+ . get_or_insert ( EMPTY_LOCATION . to_owned ( ) )
248+ . start_column = Some ( start_column) ;
245249 self
246250 }
247251 pub fn end_line < ' a > ( & ' a mut self , end_line : i32 ) -> & ' a mut Self {
248- self . location . get_or_insert ( EMPTY_LOCATION ) . end_line = Some ( end_line) ;
252+ self . location
253+ . get_or_insert ( EMPTY_LOCATION . to_owned ( ) )
254+ . end_line = Some ( end_line) ;
249255 self
250256 }
251257 pub fn end_column < ' a > ( & ' a mut self , end_column : i32 ) -> & ' a mut Self {
252- self . location . get_or_insert ( EMPTY_LOCATION ) . end_column = Some ( end_column) ;
258+ self . location
259+ . get_or_insert ( EMPTY_LOCATION . to_owned ( ) )
260+ . end_column = Some ( end_column) ;
253261 self
254262 }
255263}
0 commit comments