prevent example-config generating in test builds
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
5dae086197
commit
0238f27605
2 changed files with 4 additions and 2 deletions
|
@ -9,7 +9,7 @@ use syn::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
utils::{get_simple_settings, is_cargo_build},
|
||||
utils::{get_simple_settings, is_cargo_build, is_cargo_test},
|
||||
Result,
|
||||
};
|
||||
|
||||
|
@ -17,7 +17,7 @@ const UNDOCUMENTED: &str = "# This item is undocumented. Please contribute docum
|
|||
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
pub(super) fn example_generator(input: ItemStruct, args: &[Meta]) -> Result<TokenStream> {
|
||||
if is_cargo_build() {
|
||||
if is_cargo_build() && !is_cargo_test() {
|
||||
generate_example(&input, args)?;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@ pub(crate) fn is_cargo_build() -> bool {
|
|||
.is_some()
|
||||
}
|
||||
|
||||
pub(crate) fn is_cargo_test() -> bool { std::env::args().any(|flag| flag == "--test") }
|
||||
|
||||
pub(crate) fn get_named_generics(args: &[Meta], name: &str) -> Result<Generics> {
|
||||
const DEFAULT: &str = "<>";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue