Skip to content

Commit 0b1697a

Browse files
committed
Recognize instrument-coverage in non-UTF8 rustc flags
1 parent a6fc23b commit 0b1697a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/rustflags.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::env;
2+
13
const IGNORED_LINTS: &[&str] = &["dead_code"];
24

35
pub(crate) fn toml() -> toml::Value {
@@ -8,10 +10,10 @@ pub(crate) fn toml() -> toml::Value {
810
rustflags.push(lint);
911
}
1012

11-
if let Ok(flags) = std::env::var("RUSTFLAGS") {
13+
if let Some(flags) = env::var_os("RUSTFLAGS") {
1214
// TODO: could parse this properly and allowlist or blocklist certain
1315
// flags. This is good enough to at least support cargo-llvm-cov.
14-
if flags.contains("-C instrument-coverage") {
16+
if flags.to_string_lossy().contains("-C instrument-coverage") {
1517
rustflags.extend(["-C", "instrument-coverage"]);
1618
}
1719
}

0 commit comments

Comments
 (0)