aboutsummaryrefslogtreecommitdiffstats
path: root/components/plugins/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/plugins/lib.rs')
-rw-r--r--components/plugins/lib.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/components/plugins/lib.rs b/components/plugins/lib.rs
index a7d356f47ee..9017958ea39 100644
--- a/components/plugins/lib.rs
+++ b/components/plugins/lib.rs
@@ -50,3 +50,22 @@ pub fn plugin_registrar(reg: &mut Registry) {
reg.register_lint_pass(box lints::InheritancePass as LintPassObject);
}
+
+#[macro_export]
+macro_rules! match_ignore_ascii_case {
+ ( $value: expr: $( $string: expr => $result: expr ),+ _ => $fallback: expr, ) => {
+ match_ignore_ascii_case! { $value:
+ $( $string => $result ),+
+ _ => $fallback
+ }
+ };
+ ( $value: expr: $( $string: expr => $result: expr ),+ _ => $fallback: expr ) => {
+ {
+ use std::ascii::AsciiExt;
+ match $value.as_slice() {
+ $( s if s.eq_ignore_ascii_case($string) => $result, )+
+ _ => $fallback
+ }
+ }
+ };
+}