Skip to content

Commit

Permalink
tests: use if cfg!(..) instead of #[cfg(..)] to insert Windows-specif…
Browse files Browse the repository at this point in the history
…ic config

The code compiles on all platforms, so I think `if cfg!(..)` is better.
  • Loading branch information
yuja committed Oct 7, 2023
1 parent aea135c commit d94c325
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions cli/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use std::cell::RefCell;
use std::collections::HashMap;
use std::path::{Path, PathBuf};

use itertools::Itertools as _;
use regex::{Captures, Regex};
use tempfile::TempDir;
use testutils;
Expand Down Expand Up @@ -106,10 +107,7 @@ impl TestEnvironment {
cmd.env("JJ_TIMESTAMP", timestamp.to_rfc3339());
cmd.env("JJ_OP_TIMESTAMP", timestamp.to_rfc3339());

#[cfg(all(windows, target_env = "gnu"))]
{
use itertools::Itertools as _;

if cfg!(all(windows, target_env = "gnu")) {
// MinGW executables cannot run without `mingw\bin` in the PATH (which we're
// clearing above), so we add it again here.
if let Ok(path_var) = std::env::var("PATH").or_else(|_| std::env::var("Path")) {
Expand Down

0 comments on commit d94c325

Please sign in to comment.