clippy
This commit is contained in:
@@ -239,7 +239,7 @@ where
|
|||||||
D: serde::Deserializer<'de>,
|
D: serde::Deserializer<'de>,
|
||||||
{
|
{
|
||||||
let opt: Option<String> = Option::deserialize(deserializer)?;
|
let opt: Option<String> = Option::deserialize(deserializer)?;
|
||||||
Ok(opt.and_then(|s| Level::from_str(&s)))
|
Ok(opt.and_then(|s| Level::parse(&s)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Deserialize a timestamp from Unix epoch (int or string) or RFC3339 string
|
/// Deserialize a timestamp from Unix epoch (int or string) or RFC3339 string
|
||||||
|
|||||||
@@ -123,10 +123,8 @@ impl LogHandler {
|
|||||||
|
|
||||||
for (origin, buffer) in buffers.iter() {
|
for (origin, buffer) in buffers.iter() {
|
||||||
// Apply filter if present
|
// Apply filter if present
|
||||||
if let Some(f) = filter {
|
if filter.is_some_and(|f| !origin.matches_filter(f)) {
|
||||||
if !origin.matches_filter(f) {
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
@@ -287,9 +285,7 @@ impl LogHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if message matches route's filter (if any)
|
// Check if message matches route's filter (if any)
|
||||||
let filter_matches = route.filter.as_ref().map_or(true, |f| f.matches(log_msg));
|
if !route.filter.as_ref().is_none_or(|f| f.matches(log_msg)) {
|
||||||
|
|
||||||
if !filter_matches {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ impl Level {
|
|||||||
/// - info, information
|
/// - info, information
|
||||||
/// - debug
|
/// - debug
|
||||||
/// - trace
|
/// - trace
|
||||||
pub fn from_str(s: &str) -> Option<Self> {
|
pub fn parse(s: &str) -> Option<Self> {
|
||||||
match s.to_ascii_uppercase().as_str() {
|
match s.to_ascii_uppercase().as_str() {
|
||||||
"EMERGENCY" | "EMERG" => Some(Self::EMERGENCY),
|
"EMERGENCY" | "EMERG" => Some(Self::EMERGENCY),
|
||||||
"ALERT" => Some(Self::ALERT),
|
"ALERT" => Some(Self::ALERT),
|
||||||
@@ -79,7 +79,7 @@ impl<'de> Deserialize<'de> for Level {
|
|||||||
D: de::Deserializer<'de>,
|
D: de::Deserializer<'de>,
|
||||||
{
|
{
|
||||||
let s = String::deserialize(deserializer)?;
|
let s = String::deserialize(deserializer)?;
|
||||||
Level::from_str(&s).ok_or_else(|| {
|
Level::parse(&s).ok_or_else(|| {
|
||||||
de::Error::custom(format!(
|
de::Error::custom(format!(
|
||||||
"unknown log level '{}', expected one of: emergency, alert, critical, error, warning, notice, info, debug, trace",
|
"unknown log level '{}', expected one of: emergency, alert, critical, error, warning, notice, info, debug, trace",
|
||||||
s
|
s
|
||||||
|
|||||||
Reference in New Issue
Block a user