Просмотр исходного кода

Fix failing build on travis-ci

Implemented Debug for EncodingOverride as EncodingRef doesn't implement
Debug. Field 'encoding' is formatted as Some(EncodingOverride) or None
based on its value.
Raminder Singh 9 лет назад
Родитель
Сommit
94af92f702
1 измененных файлов с 11 добавлено и 1 удалено
  1. 11 1
      src/encoding.rs

+ 11 - 1
src/encoding.rs

@@ -19,7 +19,7 @@ use std::borrow::Cow;
 #[cfg(feature = "query_encoding")] pub use self::encoding::types::EncodingRef;
 
 #[cfg(feature = "query_encoding")]
-#[derive(Copy, Clone, Debug)]
+#[derive(Copy, Clone)]
 pub struct EncodingOverride {
     /// `None` means UTF-8.
     encoding: Option<EncodingRef>
@@ -89,6 +89,16 @@ impl EncodingOverride {
     }
 }
 
+#[cfg(feature = "query_encoding")]
+impl Debug for EncodingOverride {
+    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+        write!(f, "EncodingOverride {{ encoding: ")?;
+        match self.encoding {
+            Some(_) => write!(f, "Some(EncodingOverride) }}"),
+            None => write!(f, "None }}")
+        }
+    }
+}
 
 #[cfg(not(feature = "query_encoding"))]
 #[derive(Copy, Clone, Debug)]