== and != perform case-insensitive comparisons
This commit is contained in:
parent
d6b7175bb1
commit
288ce9d2f4
|
@ -2452,6 +2452,15 @@ version = "0.2.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
|
||||
|
||||
[[package]]
|
||||
name = "unicase"
|
||||
version = "2.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
|
||||
dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.8.0"
|
||||
|
@ -2584,6 +2593,7 @@ dependencies = [
|
|||
"tokio",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"unicase",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -29,6 +29,7 @@ once_cell = "1.8.0"
|
|||
regex = "1.5.4"
|
||||
thiserror = "1.0.26"
|
||||
tracing = "0.1.26"
|
||||
unicase = "2.6.0"
|
||||
|
||||
[dependencies.command-group]
|
||||
version = "1.0.5"
|
||||
|
|
|
@ -5,6 +5,7 @@ use std::sync::Arc;
|
|||
use globset::GlobMatcher;
|
||||
use regex::Regex;
|
||||
use tracing::{debug, trace, warn};
|
||||
use unicase::UniCase;
|
||||
|
||||
use crate::error::RuntimeError;
|
||||
use crate::event::{Event, Tag};
|
||||
|
@ -180,8 +181,8 @@ impl Filter {
|
|||
|
||||
trace!(op=?self.op, pat=?self.pat, ?subject, "performing filter match");
|
||||
Ok(match (self.op, &self.pat) {
|
||||
(Op::Equal, Pattern::Exact(pat)) => subject == pat,
|
||||
(Op::NotEqual, Pattern::Exact(pat)) => subject != pat,
|
||||
(Op::Equal, Pattern::Exact(pat)) => UniCase::new(subject) == UniCase::new(pat),
|
||||
(Op::NotEqual, Pattern::Exact(pat)) => UniCase::new(subject) != UniCase::new(pat),
|
||||
(Op::Regex, Pattern::Regex(pat)) => pat.is_match(subject),
|
||||
(Op::NotRegex, Pattern::Regex(pat)) => !pat.is_match(subject),
|
||||
(Op::Glob, Pattern::Glob(pat)) => pat.is_match(subject),
|
||||
|
|
Loading…
Reference in New Issue