- let r = Regex::new(&format!(r#"{}\s*=\s*"([^"]*)""#, escape(attr)))
- .expect("malformed regex for find_attr_val");
+ lazy_static::lazy_static! {
+ static ref ISSUE: Regex = Regex::new(r#"issue\s*=\s*"([^"]*)""#).unwrap();
+ static ref FEATURE: Regex = Regex::new(r#"feature\s*=\s*"([^"]*)""#).unwrap();
+ static ref SINCE: Regex = Regex::new(r#"since\s*=\s*"([^"]*)""#).unwrap();
+ }
+
+ let r = match attr {
+ "issue" => &*ISSUE,
+ "feature" => &*FEATURE,
+ "since" => &*SINCE,
+ _ => unimplemented!("{} not handled", attr),
+ };
+