Skip to content

Commit 64f0908

Browse files
committed
Rust: keep FlushGuard in a variable
1 parent 5621eec commit 64f0908

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

rust/extractor/src/main.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,21 @@ fn main() -> anyhow::Result<()> {
186186
qltest::prepare(&mut cfg)?;
187187
}
188188
let start = Instant::now();
189-
let flame_layer = if let Some(path) = &cfg.flame_log {
190-
tracing_flame::FlameLayer::with_file(path).ok()
189+
let (flame_layer, _flush_guard) = if let Some(path) = &cfg.flame_log {
190+
tracing_flame::FlameLayer::with_file(path)
191+
.ok()
192+
.map(|(a, b)| (Some(a), Some(b)))
193+
.unwrap_or((None, None))
191194
} else {
192-
None
195+
(None, None)
193196
};
197+
194198
tracing_subscriber::registry()
195199
.with(codeql_extractor::extractor::default_subscriber_with_level(
196200
"single_arch",
197201
&cfg.verbosity,
198202
))
199-
.with(flame_layer.map(|x| x.0))
203+
.with(flame_layer)
200204
.init();
201205
info!("{cfg:#?}\n");
202206

@@ -247,6 +251,5 @@ fn main() -> anyhow::Result<()> {
247251
}
248252
}
249253
}
250-
251254
extractor.emit_extraction_diagnostics(start, &cfg)
252255
}

0 commit comments

Comments
 (0)