]> git.lizzy.rs Git - rust.git/blobdiff - src/config/options.rs
Release v1.4.2
[rust.git] / src / config / options.rs
index 663c5d4dee220b6c38eef51f4755a0ef3d1e1ada..cf1a328e9cd85d787ad33942c4a4ce71b9206b5b 100644 (file)
@@ -3,7 +3,8 @@
 use std::path::{Path, PathBuf};
 
 use atty;
-use config_proc_macro::config_type;
+use itertools::Itertools;
+use rustfmt_config_proc_macro::config_type;
 use serde::de::{SeqAccess, Visitor};
 use serde::ser::SerializeSeq;
 use serde::{Deserialize, Deserializer, Serialize, Serializer};
@@ -193,6 +194,12 @@ pub struct WidthHeuristics {
     pub single_line_if_else_max_width: usize,
 }
 
+impl fmt::Display for WidthHeuristics {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(f, "{:?}", self)
+    }
+}
+
 impl WidthHeuristics {
     // Using this WidthHeuristics means we ignore heuristics.
     pub fn null() -> WidthHeuristics {
@@ -264,6 +271,21 @@ pub struct IgnoreList {
     rustfmt_toml_path: PathBuf,
 }
 
+impl fmt::Display for IgnoreList {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(
+            f,
+            "[{}]",
+            self.path_set
+                .iter()
+                .format_with(", ", |path, f| f(&format_args!(
+                    "{}",
+                    path.to_string_lossy()
+                )))
+        )
+    }
+}
+
 impl Serialize for IgnoreList {
     fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
     where