Skip to content

Commit

Permalink
Merge pull request #34 from waywardmonkeys/cleanups
Browse files Browse the repository at this point in the history
Cleanups
  • Loading branch information
tommilligan committed Feb 10, 2021
2 parents de7b965 + e49aab0 commit f02609f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions src/format_changeset.rs
Expand Up @@ -76,7 +76,7 @@ macro_rules! join {
(
$elem:ident in ($iter:expr) {
$( $body:tt )*
} seperated by {
} separated by {
$( $separator:tt )*
}
) => (
Expand All @@ -103,15 +103,15 @@ 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)?;
});
}
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)?;
});
Expand All @@ -128,15 +128,15 @@ 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)?;
});
}
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)?;
});
Expand Down
26 changes: 12 additions & 14 deletions src/lib.rs
Expand Up @@ -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};
//! ```
//!
//! <details>
//! <summary>Show the example behind the screenshots above.</summary>
//!
//! ```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<String, String>,
//! }
//! #[derive(Debug, PartialEq)]
//! struct Foo {
//! lorem: &'static str,
//! ipsum: u32,
//! dolor: Result<String, 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())});
//! 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);
//! ```
//! </details>
//!
Expand All @@ -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};
//! ```
Expand Down

0 comments on commit f02609f

Please sign in to comment.