From: Siddharth Agarwal Date: Mon, 31 Jul 2017 16:38:43 +0000 (-0700) Subject: derive/impl Debug for a few data structures X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~7^2~38^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=876af7c1d66637caf0141446e746e73708e53fe7;p=cargo.git derive/impl Debug for a few data structures I found this to be extremely useful while trying to write a wrapper on top of cargo. --- diff --git a/src/cargo/core/shell.rs b/src/cargo/core/shell.rs index d6edde59c..8c330a05d 100644 --- a/src/cargo/core/shell.rs +++ b/src/cargo/core/shell.rs @@ -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), Stream(StandardStream, ColorChoice), diff --git a/src/cargo/ops/cargo_compile.rs b/src/cargo/ops/cargo_compile.rs index c1b0243e7..6d2ba3bd7 100644 --- a/src/cargo/ops/cargo_compile.rs +++ b/src/cargo/ops/cargo_compile.rs @@ -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. diff --git a/src/cargo/util/config.rs b/src/cargo/util/config.rs index ede87eaba..264f746f6 100644 --- a/src/cargo/util/config.rs +++ b/src/cargo/util/config.rs @@ -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, diff --git a/src/cargo/util/lazy_cell.rs b/src/cargo/util/lazy_cell.rs index 2d42a50ec..8239559d8 100644 --- a/src/cargo/util/lazy_cell.rs +++ b/src/cargo/util/lazy_cell.rs @@ -10,6 +10,7 @@ use std::cell::UnsafeCell; +#[derive(Debug)] pub struct LazyCell { inner: UnsafeCell>, } diff --git a/src/cargo/util/rustc.rs b/src/cargo/util/rustc.rs index 9118f2213..ee68ab769 100644 --- a/src/cargo/util/rustc.rs +++ b/src/cargo/util/rustc.rs @@ -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,