fn extract_thread_name(thread_name: &str) -> String {
    lazy_static! {
        static ref THREAD_NAME_RE: Regex =
            Regex::new(r"^(?P<thread_name>[a-z-_ :]+?)(-?\d)*$").unwrap();
        static ref THREAD_NAME_REPLACE_SEPARATOR_RE: Regex = Regex::new(r"[_ ]").unwrap();
    }

    THREAD_NAME_RE
        .captures(thread_name)
        .and_then(|cap| {
            cap.name("thread_name").map(|thread_name| {
                THREAD_NAME_REPLACE_SEPARATOR_RE
                    .replace_all(thread_name.as_str(), "-")
                    .into_owned()
            })
        })
        .unwrap_or_else(|| thread_name.to_owned())
}
/// Drops the thread number, if any, from the thread name and replaces all
/// underscores and spaces with dashes.
Drops the thread number, if any, from the thread name and replaces all
underscores and spaces with dashes.
Drops the thread number if any from the thread name and replaces all underscores and spaces with dashes .
fn extract_thread_name(thread_name: &str) -> String {
    lazy_static! {
        static ref THREAD_NAME_RE: Regex =
            Regex::new(r"^(?P<thread_name>[a-z-_ :]+?)(-?\d)*$").unwrap();
        static ref THREAD_NAME_REPLACE_SEPARATOR_RE: Regex = Regex::new(r"[_ ]").unwrap();
    }
    THREAD_NAME_RE
        .captures(thread_name)
        .and_then(|cap| {
            cap.name("thread_name").map(|thread_name| {
                THREAD_NAME_REPLACE_SEPARATOR_RE
                    .replace_all(thread_name.as_str(), "-")
                    .into_owned()
            })
        })
        .unwrap_or_else(|| thread_name.to_owned())
}
fn extract_thread_name ( thread_name : & str ) -> String { lazy_static ! { static ref THREAD_NAME_RE Regex Regex new ( r"^(?P<thread_name>[a-z-_ :]+?)(-?\d)*$" ) unwrap ( ) static ref THREAD_NAME_REPLACE_SEPARATOR_RE Regex Regex new ( r"[_ ]" ) unwrap ( ) } THREAD_NAME_RE . captures ( thread_name ) . and_then ( | cap | { cap . name ( " " ) . map ( | thread_name | { THREAD_NAME_REPLACE_SEPARATOR_RE . replace_all ( thread_name . as_str ( ) , " " ) . into_owned ( ) } ) } ) . unwrap_or_else ( | | thread_name . to_owned ( ) ) }
Drops the thread number, if any, from the thread name and replaces all
underscores and spaces with dashes.
Drops the thread number if any from the thread name and replaces all underscores and spaces with dashes .
thread_name
&str
thread_name
&str