]> git.proxmox.com Git - cargo.git/commitdiff
derive/impl Debug for a few data structures
authorSiddharth Agarwal <sid0@fb.com>
Mon, 31 Jul 2017 16:38:43 +0000 (09:38 -0700)
committerSiddharth Agarwal <sid0@fb.com>
Mon, 31 Jul 2017 17:09:40 +0000 (10:09 -0700)
I found this to be extremely useful while trying to write a wrapper on
top of cargo.

src/cargo/core/shell.rs
src/cargo/ops/cargo_compile.rs
src/cargo/util/config.rs
src/cargo/util/lazy_cell.rs
src/cargo/util/rustc.rs

index d6edde59ca4d3d814ea132c2ed353a3f11fe50a3..8c330a05dc203ef791bd769badd9ef6268bdeb37 100644 (file)
@@ -19,6 +19,12 @@ pub struct Shell {
     verbosity: Verbosity,
 }
 
+impl fmt::Debug for Shell {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(f, "Shell")
+    }
+}
+
 enum ShellOut {
     Write(Box<Write>),
     Stream(StandardStream, ColorChoice),
index c1b0243e78642052b9ae0cc9dc43b1fe7e0fac0a..6d2ba3bd7a065c12b5458e0f83a66dcab4badadd 100644 (file)
@@ -35,6 +35,7 @@ use util::config::Config;
 use util::{CargoResult, profile};
 
 /// Contains information about how a package should be compiled.
+#[derive(Debug)]
 pub struct CompileOptions<'a> {
     pub config: &'a Config,
     /// Number of concurrent jobs to use.
@@ -96,7 +97,7 @@ pub enum CompileMode {
     Doctest,
 }
 
-#[derive(Clone, Copy, PartialEq, Eq, Deserialize)]
+#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize)]
 pub enum MessageFormat {
     Human,
     Json
@@ -149,12 +150,13 @@ impl<'a> Packages<'a> {
     }
 }
 
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Debug)]
 pub enum FilterRule<'a> {
     All,
     Just (&'a [String]),
 }
 
+#[derive(Debug)]
 pub enum CompileFilter<'a> {
     Everything {
         /// Flag whether targets can be safely skipped when required-features are not satisfied.
index ede87eabaa20983abde8be86d704cc8c3063b841..264f746f660c618ed6e7ac0961391913b85dd101 100644 (file)
@@ -26,6 +26,7 @@ use util::toml as cargo_toml;
 
 use self::ConfigValue as CV;
 
+#[derive(Debug)]
 pub struct Config {
     home_path: Filesystem,
     shell: RefCell<Shell>,
index 2d42a50ecf35bef07b243ed1b9a04d29c7b42b59..8239559d8df7e7cba9d1b5be304ed09632bf5840 100644 (file)
@@ -10,6 +10,7 @@
 
 use std::cell::UnsafeCell;
 
+#[derive(Debug)]
 pub struct LazyCell<T> {
     inner: UnsafeCell<Option<T>>,
 }
index 9118f2213fe00d87efd6e77d465c7ed43a1fa9ff..ee68ab76959cd03fd9582217623f3bc341df255c 100644 (file)
@@ -2,6 +2,7 @@ use std::path::PathBuf;
 
 use util::{self, CargoResult, internal, ProcessBuilder};
 
+#[derive(Debug)]
 pub struct Rustc {
     pub path: PathBuf,
     pub wrapper: Option<PathBuf>,