Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse std::env::consts::EXE_SUFFIX #6758

Merged
merged 1 commit into from
Mar 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions tests/testsuite/support/install.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::env::consts::EXE_SUFFIX;
use std::path::{Path, PathBuf};

use crate::support::paths;
Expand All @@ -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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why format! rather than the more performant [name, EXE_SUFFIX].concat()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have nothing again using that instead.

}
2 changes: 1 addition & 1 deletion tests/testsuite/support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 &macros {
Expand Down