1 | use std::env; |
2 | use std::ffi::OsString; |
3 | |
4 | const RUSTFLAGS: &str = "RUSTFLAGS" ; |
5 | const IGNORED_LINTS: &[&str] = &["dead_code" ]; |
6 | |
7 | pub fn make_vec() -> Vec<&'static str> { |
8 | let mut rustflags = vec!["--cfg" , "trybuild" ]; |
9 | |
10 | for &lint in IGNORED_LINTS { |
11 | rustflags.push("-A" ); |
12 | rustflags.push(lint); |
13 | } |
14 | |
15 | rustflags |
16 | } |
17 | |
18 | pub fn envs() -> impl IntoIterator<Item = (&'static str, OsString)> { |
19 | let mut rustflags = env::var_os(RUSTFLAGS)?; |
20 | |
21 | for flag in make_vec() { |
22 | rustflags.push(" " ); |
23 | rustflags.push(flag); |
24 | } |
25 | |
26 | Some((RUSTFLAGS, rustflags)) |
27 | } |
28 | |