diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e013a7..bb97405 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,3 +11,5 @@ ## Internal - Test Windows targets in CI (#46, @tommilligan) +- Bump `ansi_term` version to 0.12 (#34, @waywardmonkeys) +- Code health improvements (#34, @waywardmonkeys) diff --git a/Cargo.toml b/Cargo.toml index 9651cd6..c44283b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ travis-ci = { repository = "colin-kiegel/rust-pretty-assertions" } [dependencies] difference = "2.0.0" -ansi_term = "0.11.0" +ansi_term = "0.12.1" [target.'cfg(windows)'.dependencies] output_vt100 = "0.1.2" diff --git a/src/format_changeset.rs b/src/format_changeset.rs index 5c4b434..fb77428 100644 --- a/src/format_changeset.rs +++ b/src/format_changeset.rs @@ -76,7 +76,7 @@ macro_rules! join { ( $elem:ident in ($iter:expr) { $( $body:tt )* - } seperated by { + } separated by { $( $separator:tt )* } ) => ( @@ -103,7 +103,7 @@ pub fn format_replacement(f: &mut dyn fmt::Write, added: &str, removed: &str) -> Difference::Same(ref word_diff) => { join!(chunk in (word_diff.split('\n')) { paint!(f, Red, "{}", chunk)?; - } seperated by { + } separated by { writeln!(f)?; paint!(f, Red, "{}", SIGN_LEFT)?; }); @@ -111,7 +111,7 @@ pub fn format_replacement(f: &mut dyn fmt::Write, added: &str, removed: &str) -> Difference::Rem(ref word_diff) => { join!(chunk in (word_diff.split('\n')) { paint!(f, Red.on(Fixed(52)).bold(), "{}", chunk)?; - } seperated by { + } separated by { writeln!(f)?; paint!(f, Red.bold(), "{}", SIGN_LEFT)?; }); @@ -128,7 +128,7 @@ pub fn format_replacement(f: &mut dyn fmt::Write, added: &str, removed: &str) -> Difference::Same(ref word_diff) => { join!(chunk in (word_diff.split('\n')) { paint!(f, Green, "{}", chunk)?; - } seperated by { + } separated by { writeln!(f)?; paint!(f, Green, "{}", SIGN_RIGHT)?; }); @@ -136,7 +136,7 @@ pub fn format_replacement(f: &mut dyn fmt::Write, added: &str, removed: &str) -> Difference::Add(ref word_diff) => { join!(chunk in (word_diff.split('\n')) { paint!(f, Green.on(Fixed(22)).bold(), "{}", chunk)?; - } seperated by { + } separated by { writeln!(f)?; paint!(f, Green.bold(), "{}", SIGN_RIGHT)?; }); diff --git a/src/lib.rs b/src/lib.rs index abe6569..10c4ec2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,31 +14,29 @@ //! //! Yep — and you only need **one line of code** to make it happen: //! -//! ```rust,ignore +//! ```rust //! use pretty_assertions::{assert_eq, assert_ne}; //! ``` //! //!
//! Show the example behind the screenshots above. //! -//! ```rust,ignore +//! ```rust,should_panic //! // 1. add the `pretty_assertions` dependency to `Cargo.toml`. //! // 2. insert this line at the top of each module, as needed //! use pretty_assertions::{assert_eq, assert_ne}; //! -//! fn main() { -//! #[derive(Debug, PartialEq)] -//! struct Foo { -//! lorem: &'static str, -//! ipsum: u32, -//! dolor: Result, -//! } +//! #[derive(Debug, PartialEq)] +//! struct Foo { +//! lorem: &'static str, +//! ipsum: u32, +//! dolor: Result, +//! } //! -//! let x = Some(Foo { lorem: "Hello World!", ipsum: 42, dolor: Ok("hey".to_string())}); -//! let y = Some(Foo { lorem: "Hello Wrold!", ipsum: 42, dolor: Ok("hey ho!".to_string())}); +//! let x = Some(Foo { lorem: "Hello World!", ipsum: 42, dolor: Ok("hey".to_string())}); +//! let y = Some(Foo { lorem: "Hello Wrold!", ipsum: 42, dolor: Ok("hey ho!".to_string())}); //! -//! assert_eq!(x, y); -//! } +//! assert_eq!(x, y); //! ``` //!
//! @@ -50,7 +48,7 @@ //! //! Also add `#[cfg(test)]` to your `use` statements, like this: //! -//! ```rust,ignore +//! ```rust //! #[cfg(test)] //! use pretty_assertions::{assert_eq, assert_ne}; //! ```