#[cfg(test)]
mod tests;
use std::env;
#[must_use]
pub fn combined_encoded_rustflags(extra_flags: &[String]) -> Option<String> {
if extra_flags.is_empty() {
return None;
}
let mut combined = env::var("CARGO_ENCODED_RUSTFLAGS").unwrap_or_else(|_| {
let mut encoded = String::new();
for flag in env::var("RUSTFLAGS").unwrap_or_default().split_whitespace() {
if !encoded.is_empty() {
encoded.push('\x1f');
}
encoded.push_str(flag);
}
encoded
});
for flag in extra_flags {
if !combined.is_empty() {
combined.push('\x1f');
}
combined.push_str(flag);
}
Some(combined)
}