]> git.proxmox.com Git - rustc.git/blobdiff - vendor/tracing-subscriber/src/filter/env/field.rs
New upstream version 1.49.0~beta.4+dfsg1
[rustc.git] / vendor / tracing-subscriber / src / filter / env / field.rs
index 1daf4fc984ed955bc504a157b4f1a303b7e1645d..994a9406dd642282c6a29cb9a0715170069b23c2 100644 (file)
@@ -13,7 +13,7 @@ use std::{
 use super::{FieldMap, LevelFilter};
 use tracing_core::field::{Field, Visit};
 
-#[derive(Debug, Eq, PartialEq, Ord)]
+#[derive(Debug, Eq, PartialEq)]
 pub(crate) struct Match {
     pub(crate) name: String, // TODO: allow match patterns for names?
     pub(crate) value: Option<ValueMatch>,
@@ -95,8 +95,8 @@ impl fmt::Display for Match {
     }
 }
 
-impl PartialOrd for Match {
-    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
+impl Ord for Match {
+    fn cmp(&self, other: &Self) -> Ordering {
         // Ordering for `Match` directives is based first on _whether_ a value
         // is matched or not. This is semantically meaningful --- we would
         // prefer to check directives that match values first as they are more
@@ -113,11 +113,15 @@ impl PartialOrd for Match {
         // This ordering is no longer semantically meaningful but is necessary
         // so that the directives can be stored in the `BTreeMap` in a defined
         // order.
-        Some(
-            has_value
-                .then_with(|| self.name.cmp(&other.name))
-                .then_with(|| self.value.cmp(&other.value)),
-        )
+        has_value
+            .then_with(|| self.name.cmp(&other.name))
+            .then_with(|| self.value.cmp(&other.value))
+    }
+}
+
+impl PartialOrd for Match {
+    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
+        Some(self.cmp(other))
     }
 }
 
@@ -229,7 +233,7 @@ impl CallsiteMatch {
             .collect();
         SpanMatch {
             fields,
-            level: self.level.clone(),
+            level: self.level,
             has_matched: AtomicBool::new(false),
         }
     }
@@ -263,7 +267,7 @@ impl SpanMatch {
     #[inline]
     pub(crate) fn filter(&self) -> Option<LevelFilter> {
         if self.is_matched() {
-            Some(self.level.clone())
+            Some(self.level)
         } else {
             None
         }