summaryrefslogtreecommitdiff
path: root/dichroism/src/image_api.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dichroism/src/image_api.rs')
-rw-r--r--dichroism/src/image_api.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/dichroism/src/image_api.rs b/dichroism/src/image_api.rs
index 44effe4..97faead 100644
--- a/dichroism/src/image_api.rs
+++ b/dichroism/src/image_api.rs
@@ -3,10 +3,11 @@ use crate::result::Result;
use base64::decode;
use regex::Regex;
-lazy_static! {
- static ref DATA_URI_RE: Regex =
- Regex::new("^data:image/(png|jpeg);base64,(?P<data>.+)").expect("Couldn't parse Regex!");
-}
+use once_cell::sync::Lazy;
+
+static DATA_URI_RE: Lazy<Regex> = Lazy::new(|| {
+ Regex::new("^data:image/(png|jpeg);base64,(?P<data>.+)").expect("Couldn't parse Regex.")
+});
pub fn generate_images(data: &str) -> Result<()> {
let bytes = decode(data)?;
@@ -24,7 +25,7 @@ pub fn extract_data(uri: &str) -> Result<&str> {
Ok(caps
.name("data")
- .expect("Should never fail if regex succeeded")
+ .expect("Should never fail if regex succeeded.")
.as_str())
}