-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to skip runtime feature for clippy run (#440)
- Loading branch information
Showing
4 changed files
with
95 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,33 @@ | ||
use std::{collections::HashSet, env}; | ||
|
||
fn main() { | ||
let mut clippy = false; | ||
let mut features = HashSet::<&'static str>::default(); | ||
|
||
for (key, _val) in env::vars() { | ||
for (key, val) in env::vars() { | ||
let _ = match key.as_ref() { | ||
"CARGO_FEATURE_COMPIO" => features.insert("compio"), | ||
"CARGO_FEATURE_TOKIO" => features.insert("tokio"), | ||
"CARGO_FEATURE_GLOMMIO" => features.insert("glommio"), | ||
"CARGO_FEATURE_ASYNC_STD" => features.insert("async-std"), | ||
"CARGO_CFG_FEATURE" => { | ||
if val.contains("cargo-clippy") { | ||
clippy = true; | ||
} | ||
false | ||
} | ||
_ => false, | ||
}; | ||
} | ||
|
||
if features.is_empty() { | ||
panic!("Runtime must be selected '--feature=ntex/$runtime', available options are \"compio\", \"tokio\", \"async-std\", \"glommio\""); | ||
} else if features.len() > 1 { | ||
panic!( | ||
"Only one runtime feature could be selected, current selection {:?}", | ||
features | ||
); | ||
if !clippy { | ||
if features.is_empty() { | ||
panic!("Runtime must be selected '--feature=ntex/$runtime', available options are \"compio\", \"tokio\", \"async-std\", \"glommio\""); | ||
} else if features.len() > 1 { | ||
panic!( | ||
"Only one runtime feature could be selected, current selection {:?}", | ||
features | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters