Skip to content

Commit 3218fae

Browse files
committed
Rust: make flame_log a config option
1 parent 0442d24 commit 3218fae

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

rust/extractor/src/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ pub struct Config {
5151
pub cargo_target: Option<String>,
5252
pub cargo_features: Vec<String>,
5353
pub cargo_cfg_overrides: Vec<String>,
54+
pub flame_log: Option<PathBuf>,
5455
pub verbose: u8,
5556
pub compression: Compression,
5657
pub inputs: Vec<PathBuf>,

rust/extractor/src/main.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,12 @@ fn cwd() -> anyhow::Result<AbsPathBuf> {
181181
}
182182

183183
fn main() -> anyhow::Result<()> {
184+
let mut cfg = config::Config::extract().context("failed to load configuration")?;
185+
if cfg.qltest {
186+
qltest::prepare(&mut cfg)?;
187+
}
184188
let start = Instant::now();
185-
let flame_layer = if let Ok(path) = std::env::var("CODEQL_EXTRACTOR_RUST_OPTION_FLAME_LOG") {
189+
let flame_layer = if let Some(path) = &cfg.flame_log {
186190
tracing_flame::FlameLayer::with_file(path).ok()
187191
} else {
188192
None
@@ -193,11 +197,6 @@ fn main() -> anyhow::Result<()> {
193197
))
194198
.with(flame_layer.map(|x| x.0))
195199
.init();
196-
197-
let mut cfg = config::Config::extract().context("failed to load configuration")?;
198-
if cfg.qltest {
199-
qltest::prepare(&mut cfg)?;
200-
}
201200
info!("{cfg:#?}\n");
202201

203202
let traps = trap::TrapFileProvider::new(&cfg).context("failed to set up trap files")?;

0 commit comments

Comments
 (0)