@@ -62,7 +62,7 @@ fn sample_console(pid: remoteprocess::Pid, config: &Config) -> Result<(), Error>
6262
6363 let display = match remoteprocess:: Process :: new ( pid) ?. cmdline ( ) {
6464 Ok ( cmdline) => cmdline. join ( " " ) ,
65- Err ( _) => format ! ( "Pid {}" , pid ) ,
65+ Err ( _) => format ! ( "Pid {pid}" ) ,
6666 } ;
6767
6868 let mut console =
@@ -81,7 +81,7 @@ fn sample_console(pid: remoteprocess::Pid, config: &Config) -> Result<(), Error>
8181 }
8282
8383 if !config. subprocesses {
84- println ! ( "\n process {} ended" , pid ) ;
84+ println ! ( "\n process {pid } ended" ) ;
8585 }
8686 Ok ( ( ) )
8787}
@@ -163,7 +163,7 @@ fn record_samples(pid: remoteprocess::Pid, config: &Config) -> Result<(), Error>
163163 None => String :: from ( "unknown" ) ,
164164 } ,
165165 } ;
166- format ! ( "{}-{}.{}" , name , local_time , ext )
166+ format ! ( "{name }-{local_time }.{ext}" )
167167 }
168168 } ;
169169
@@ -237,12 +237,12 @@ fn record_samples(pid: remoteprocess::Pid, config: &Config) -> Result<(), Error>
237237 let now = std:: time:: Instant :: now ( ) ;
238238 if now - last_late_message > Duration :: from_secs ( 1 ) {
239239 last_late_message = now;
240- println ! ( "{}{ :.2?} behind in sampling, results may be inaccurate. Try reducing the sampling rate" , lede , delay )
240+ println ! ( "{lede}{delay :.2?} behind in sampling, results may be inaccurate. Try reducing the sampling rate" )
241241 }
242242 } else {
243243 let term = console:: Term :: stdout ( ) ;
244244 term. move_cursor_up ( 2 ) ?;
245- println ! ( "{:.2?} behind in sampling, results may be inaccurate. Try reducing the sampling rate." , delay ) ;
245+ println ! ( "{delay :.2?} behind in sampling, results may be inaccurate. Try reducing the sampling rate." ) ;
246246 term. move_cursor_down ( 1 ) ?;
247247 }
248248 }
@@ -273,9 +273,9 @@ fn record_samples(pid: remoteprocess::Pid, config: &Config) -> Result<(), Error>
273273 if config. include_thread_ids {
274274 let threadid = trace. format_threadid ( ) ;
275275 let thread_fmt = if let Some ( thread_name) = & trace. thread_name {
276- format ! ( "thread ({}): {}" , threadid , thread_name )
276+ format ! ( "thread ({threadid }): {thread_name}" )
277277 } else {
278- format ! ( "thread ({})" , threadid )
278+ format ! ( "thread ({threadid })" )
279279 } ;
280280 trace. frames . push ( Frame {
281281 name : thread_fmt,
@@ -313,9 +313,9 @@ fn record_samples(pid: remoteprocess::Pid, config: &Config) -> Result<(), Error>
313313
314314 if config. duration == RecordDuration :: Unlimited {
315315 let msg = if errors > 0 {
316- format ! ( "Collected {} samples ({} errors)" , samples , errors )
316+ format ! ( "Collected {samples } samples ({errors } errors)" )
317317 } else {
318- format ! ( "Collected {} samples" , samples )
318+ format ! ( "Collected {samples } samples" )
319319 } ;
320320 progress. set_message ( msg) ;
321321 }
@@ -324,7 +324,7 @@ fn record_samples(pid: remoteprocess::Pid, config: &Config) -> Result<(), Error>
324324 progress. finish ( ) ;
325325 // write out a message here (so as not to interfere with progress bar) if we ended earlier
326326 if !exit_message. is_empty ( ) {
327- println ! ( "\n {}{}" , lede , exit_message ) ;
327+ println ! ( "\n {lede}{exit_message}" ) ;
328328 }
329329
330330 {
@@ -335,8 +335,7 @@ fn record_samples(pid: remoteprocess::Pid, config: &Config) -> Result<(), Error>
335335 match config. format . as_ref ( ) . unwrap ( ) {
336336 FileFormat :: flamegraph => {
337337 println ! (
338- "{}Wrote flamegraph data to '{}'. Samples: {} Errors: {}" ,
339- lede, filename, samples, errors
338+ "{lede}Wrote flamegraph data to '{filename}'. Samples: {samples} Errors: {errors}"
340339 ) ;
341340 // open generated flame graph in the browser on OSX (theory being that on linux
342341 // you might be SSH'ed into a server somewhere and this isn't desired, but on
@@ -346,27 +345,21 @@ fn record_samples(pid: remoteprocess::Pid, config: &Config) -> Result<(), Error>
346345 }
347346 FileFormat :: speedscope => {
348347 println ! (
349- "{}Wrote speedscope file to '{}'. Samples: {} Errors: {}" ,
350- lede, filename, samples, errors
348+ "{lede}Wrote speedscope file to '{filename}'. Samples: {samples} Errors: {errors}"
351349 ) ;
352- println ! ( "{}Visit https://www.speedscope.app/ to view" , lede ) ;
350+ println ! ( "{lede }Visit https://www.speedscope.app/ to view" ) ;
353351 }
354352 FileFormat :: raw => {
355353 println ! (
356- "{}Wrote raw flamegraph data to '{}'. Samples: {} Errors: {}" ,
357- lede, filename, samples, errors
354+ "{lede}Wrote raw flamegraph data to '{filename}'. Samples: {samples} Errors: {errors}"
358355 ) ;
359- println ! ( "{}You can use the flamegraph.pl script from https://github.com/brendangregg/flamegraph to generate a SVG" , lede ) ;
356+ println ! ( "{lede }You can use the flamegraph.pl script from https://github.com/brendangregg/flamegraph to generate a SVG" ) ;
360357 }
361358 FileFormat :: chrometrace => {
362359 println ! (
363- "{}Wrote chrome trace to '{}'. Samples: {} Errors: {}" ,
364- lede, filename, samples, errors
365- ) ;
366- println ! (
367- "{}Visit chrome://tracing or https://ui.perfetto.dev/ to view" ,
368- lede
360+ "{lede}Wrote chrome trace to '{filename}'. Samples: {samples} Errors: {errors}"
369361 ) ;
362+ println ! ( "{lede}Visit chrome://tracing or https://ui.perfetto.dev/ to view" ) ;
370363 }
371364 } ;
372365
@@ -468,7 +461,7 @@ fn pyspy_main() -> Result<(), Error> {
468461 if config. capture_output && ( !success || result. is_err ( ) ) {
469462 let mut buffer = String :: new ( ) ;
470463 if process_output. read_to_string ( & mut buffer) . is_ok ( ) {
471- eprintln ! ( "{}" , buffer ) ;
464+ eprintln ! ( "{buffer}" ) ;
472465 }
473466 }
474467
@@ -516,10 +509,10 @@ fn main() {
516509 }
517510 }
518511
519- eprintln ! ( "Error: {}" , err ) ;
512+ eprintln ! ( "Error: {err}" ) ;
520513 for ( i, suberror) in err. chain ( ) . enumerate ( ) {
521514 if i > 0 {
522- eprintln ! ( "Reason: {}" , suberror ) ;
515+ eprintln ! ( "Reason: {suberror}" ) ;
523516 }
524517 }
525518 std:: process:: exit ( 1 ) ;
0 commit comments