}
}
+ #[allow(unreachable_pub)]
+ pub fn is_valid_key_val(key: &str, val: &str) -> bool {
+ match key {
+ $(
+ stringify!($i) => val.parse::<$ty>().is_ok(),
+ )+
+ _ => false,
+ }
+ }
+
#[allow(unreachable_pub)]
pub fn used_options(&self) -> PartialConfig {
PartialConfig {
}
name_out.push_str(name_raw);
name_out.push(' ');
+ let mut default_str = format!("{}", $def);
+ if default_str.is_empty() {
+ default_str = String::from("\"\"");
+ }
writeln!(out,
- "{}{} Default: {:?}{}",
+ "{}{} Default: {}{}",
name_out,
<$ty>::doc_hint(),
- $def,
+ default_str,
if !$stb { " (unstable)" } else { "" }).unwrap();
$(
writeln!(out, "{}{}", space_str, $dstring).unwrap();
fn set_license_template(&mut self) {
if self.was_set().license_template_path() {
let lt_path = self.license_template_path();
- match license::load_and_compile_template(<_path) {
- Ok(re) => self.license_template = Some(re),
- Err(msg) => eprintln!("Warning for license template file {:?}: {}",
- lt_path, msg),
+ if lt_path.len() > 0 {
+ match license::load_and_compile_template(<_path) {
+ Ok(re) => self.license_template = Some(re),
+ Err(msg) => eprintln!("Warning for license template file {:?}: {}",
+ lt_path, msg),
+ }
}
}
}