opt-level 1.0.0

Get value of rustc `-Copt-level=` flag
Documentation
1
2
3
4
5
6
7
8
9
10
use std::env;
use std::fs;
use std::path::Path;

fn main() {
    let out_dir = env::var_os("OUT_DIR").unwrap();
    let opt_level = env::var("OPT_LEVEL").unwrap();
    let dest_path = Path::new(&out_dir).join("opt-level");
    fs::write(dest_path, opt_level).unwrap();
}