on master help sign in
simplify build.rs
commita4828387c1a09e5185aa33b338b2d70dc2510f27 authorLzu Tao <taolzu@gmail.com> dateFri 24 Apr 2020, 05:56 (7 years ago) parentabeac8b
1 file changed+5−6
build.rs+5−6
build.rs+5−6
@@ -14,13 +14,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
1414
1515 use lazy_static::lazy_static;
1616
17+ static PROJECT_VERSION: &str = env!("CARGO_PKG_VERSION");
18+
1719 // Read environment variables.
1820 lazy_static! {
1921 static ref PROJECT_NAME: &'static str = option_env!("PROJECT_NAME").unwrap_or("bat");
20− static ref PROJECT_VERSION: &'static str = option_env!("CARGO_PKG_VERSION").unwrap();
21− static ref EXECUTABLE_NAME: &'static str = option_env!("PROJECT_EXECUTABLE")
22− .or(option_env!("PROJECT_NAME"))
23− .unwrap_or("bat");
22+ static ref EXECUTABLE_NAME: &'static str = option_env!("PROJECT_EXECUTABLE").unwrap_or(*PROJECT_NAME);
2423 }
2524
2625 /// Generates a file from a liquid template.
@@ -46,8 +45,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
4645 let out_dir_env = std::env::var_os("OUT_DIR").expect("OUT_DIR to be set in build.rs");
4746 let out_dir = Path::new(&out_dir_env);
4847
49− std::fs::create_dir_all(out_dir.join("assets/manual")).unwrap();
50− std::fs::create_dir_all(out_dir.join("assets/completions")).unwrap();
48+ fs::create_dir_all(out_dir.join("assets/manual")).unwrap();
49+ fs::create_dir_all(out_dir.join("assets/completions")).unwrap();
5150
5251 template(
5352 &variables,