minor: Add some debug traces for cfg fetching

This commit is contained in:
Lukas Wirth 2022-02-01 13:32:09 +01:00
parent fcdced115e
commit dbd5a70ea3
2 changed files with 43 additions and 26 deletions

View file

@ -1,7 +1,7 @@
//! Parsing of CfgFlags as command line arguments, as in
//!
//! rustc main.rs --cfg foo --cfg 'feature="bar"'
use std::str::FromStr;
use std::{fmt, str::FromStr};
use cfg::CfgOptions;
@ -48,3 +48,16 @@ impl Extend<CfgFlag> for CfgOptions {
}
}
}
impl fmt::Display for CfgFlag {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
CfgFlag::Atom(atom) => f.write_str(atom),
CfgFlag::KeyValue { key, value } => {
f.write_str(key)?;
f.write_str("=")?;
f.write_str(value)
}
}
}
}