• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use std::process::{Command, ExitStatus, Stdio};
2 
has_cargo_expand() -> bool3 fn has_cargo_expand() -> bool {
4     let cargo_expand = if cfg!(windows) {
5         "cargo-expand.exe"
6     } else {
7         "cargo-expand"
8     };
9 
10     Command::new(cargo_expand)
11         .arg("--version")
12         .stdin(Stdio::null())
13         .stdout(Stdio::null())
14         .stderr(Stdio::null())
15         .status()
16         .as_ref()
17         .map(ExitStatus::success)
18         .unwrap_or(false)
19 }
20 
has_rustfmt() -> bool21 fn has_rustfmt() -> bool {
22     toolchain_find::find_installed_component("rustfmt").is_some()
23 }
24 
main()25 fn main() {
26     if cfg!(feature = "expandtest") && has_cargo_expand() && has_rustfmt() {
27         println!("cargo:rustc-cfg=expandtest");
28     }
29 }
30