summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLzu Tao <taolzu@gmail.com>2020-04-24 05:56:54 +0000
committerDavid Peter <sharkdp@users.noreply.github.com>2020-04-24 16:11:05 +0200
commita4828387c1a09e5185aa33b338b2d70dc2510f27 (patch)
tree2b6f005113bdd9556262f2e90035b393158a9697
parentabeac8b12e9e4c0bc6d9c03ce0d12751a81e9757 (diff)
simplify build.rs
-rw-r--r--build.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/build.rs b/build.rs
index 074caaff..4bf6173c 100644
--- a/build.rs
+++ b/build.rs
@@ -14,13 +14,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
use lazy_static::lazy_static;
+ static PROJECT_VERSION: &str = env!("CARGO_PKG_VERSION");
+
// Read environment variables.
lazy_static! {
static ref PROJECT_NAME: &'static str = option_env!("PROJECT_NAME").unwrap_or("bat");
- static ref PROJECT_VERSION: &'static str = option_env!("CARGO_PKG_VERSION").unwrap();
- static ref EXECUTABLE_NAME: &'static str = option_env!("PROJECT_EXECUTABLE")
- .or(option_env!("PROJECT_NAME"))
- .unwrap_or("bat");
+ static ref EXECUTABLE_NAME: &'static str = option_env!("PROJECT_EXECUTABLE").unwrap_or(*PROJECT_NAME);
}
/// Generates a file from a liquid template.
@@ -46,8 +45,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let out_dir_env = std::env::var_os("OUT_DIR").expect("OUT_DIR to be set in build.rs");
let out_dir = Path::new(&out_dir_env);
- std::fs::create_dir_all(out_dir.join("assets/manual")).unwrap();
- std::fs::create_dir_all(out_dir.join("assets/completions")).unwrap();
+ fs::create_dir_all(out_dir.join("assets/manual")).unwrap();
+ fs::create_dir_all(out_dir.join("assets/completions")).unwrap();
template(
&variables,