convert comma to dot, remove TODOs

This commit is contained in:
jb-alvarado 2023-08-06 21:17:33 +02:00
parent ce8523ea96
commit d3b52eb29c
3 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,6 @@
use std::{fmt, sync::atomic::Ordering};
use regex::Regex;
extern crate serde;
extern crate serde_json;
extern crate tiny_http;
@ -55,7 +56,11 @@ where
Err(serde::de::Error::custom("Invalid number format"))
}
}
Value::String(string) => Ok(Some(string)),
Value::String(string) => {
let re = Regex::new(r"0,([0-9]+)").unwrap();
let clean_string = re.replace_all(&string, "0.$1").to_string();
Ok(Some(clean_string))
}
_ => Err(serde::de::Error::custom("Invalid value type")),
}
}

View File

@ -25,7 +25,6 @@ pub fn filter_node(
_ => config.text.zmq_stream_socket.clone(),
};
// TODO: in Rust 1.66 use let_chains instead
if config.text.text_from_filename && node.is_some() {
let source = node.unwrap_or(&Media::new(0, "", false)).source.clone();
let text = match Regex::new(&config.text.regex)

View File

@ -155,8 +155,6 @@ impl SharedLogger for LogMailer {
}
/// Workaround to remove color information from log
///
/// ToDo: maybe in next version from simplelog this is not necessary anymore.
fn clean_string(text: &str) -> String {
let regex = Regex::new(r"\x1b\[[0-9;]*[mGKF]").unwrap();