11use std:: collections:: { HashMap , HashSet } ;
22use std:: fmt:: Display ;
3- use std:: fs:: File ;
43use std:: path:: PathBuf ;
54
65use anyhow:: { Result , anyhow} ;
@@ -301,7 +300,7 @@ pub(crate) fn find_sysroot(ctx: &Context) -> Result<Utf8PathBuf> {
301300
302301pub ( crate ) fn compute_project_json (
303302 ctx : & Context ,
304- discover_args : DiscoverArgs ,
303+ # [ allow ( unused ) ] discover_args : DiscoverArgs ,
305304 metadata : Metadata ,
306305 manifest_path : FilePath < ' _ > ,
307306) -> Result < ProjectJson > {
@@ -310,7 +309,13 @@ pub(crate) fn compute_project_json(
310309 debug ! ( sysroot = %sysroot) ;
311310
312311 let sysroot_src = sysroot. join ( "lib/rustlib/src/rust/library" ) ;
313- let crates = crates_from_metadata ( ctx, discover_args, metadata, manifest_path) ?;
312+ let crates = crates_from_metadata (
313+ ctx,
314+ #[ cfg( not( target_os = "windows" ) ) ]
315+ discover_args. flamegraph ,
316+ metadata,
317+ manifest_path,
318+ ) ?;
314319
315320 Ok ( ProjectJson {
316321 sysroot,
@@ -565,14 +570,13 @@ impl PackageGraph {
565570
566571fn crates_from_metadata (
567572 ctx : & Context ,
568- discover_args : DiscoverArgs ,
573+ # [ cfg ( not ( target_os = "windows" ) ) ] flamegraph : Option < PathBuf > ,
569574 metadata : Metadata ,
570575 manifest_path : FilePath < ' _ > ,
571576) -> Result < Vec < Crate > > {
572577 #[ cfg( not( target_os = "windows" ) ) ]
573578 let pprof_guard = {
574- discover_args
575- . flamegraph
579+ flamegraph
576580 . as_ref ( )
577581 . map ( |path| {
578582 Ok :: < _ , anyhow:: Error > ( (
@@ -607,7 +611,7 @@ fn crates_from_metadata(
607611 #[ cfg( not( target_os = "windows" ) ) ]
608612 if let Some ( ( guard, path) ) = pprof_guard {
609613 let report = guard. report ( ) . build ( ) ?;
610- let file = File :: create ( path) ?;
614+ let file = std :: fs :: File :: create ( path) ?;
611615
612616 report. flamegraph ( file) ?;
613617 }
0 commit comments