From cd570b3506be3f44357818dc236f85ab18bd5fa9 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Sat, 16 Mar 2019 21:48:30 +0000 Subject: [PATCH] Reuse std::env::consts::EXE_SUFFIX --- tests/testsuite/support/install.rs | 7 ++----- tests/testsuite/support/mod.rs | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/testsuite/support/install.rs b/tests/testsuite/support/install.rs index 9e096c9247e..8e5bbd073bc 100644 --- a/tests/testsuite/support/install.rs +++ b/tests/testsuite/support/install.rs @@ -1,3 +1,4 @@ +use std::env::consts::EXE_SUFFIX; use std::path::{Path, PathBuf}; use crate::support::paths; @@ -23,9 +24,5 @@ pub fn cargo_home() -> PathBuf { } pub fn exe(name: &str) -> String { - if cfg!(windows) { - format!("{}.exe", name) - } else { - name.to_string() - } + format!("{}{}", name, EXE_SUFFIX) } diff --git a/tests/testsuite/support/mod.rs b/tests/testsuite/support/mod.rs index d9ced3e5574..29171d71837 100644 --- a/tests/testsuite/support/mod.rs +++ b/tests/testsuite/support/mod.rs @@ -1519,7 +1519,7 @@ fn substitute_macros(input: &str) -> String { ("[UNPACKING]", " Unpacking"), ("[SUMMARY]", " Summary"), ("[FIXING]", " Fixing"), - ("[EXE]", if cfg!(windows) { ".exe" } else { "" }), + ("[EXE]", env::consts::EXE_SUFFIX), ]; let mut result = input.to_owned(); for &(pat, subst) in ¯os {