From a2ef3190cff912e608313e5ea6ca4696a4f8445e Mon Sep 17 00:00:00 2001 From: Tom Milligan Date: Mon, 13 Sep 2021 12:15:23 +0100 Subject: [PATCH] [fixup] rebase on main, intersection with unstable --- pretty_assertions/Cargo.toml | 19 ++++++++----------- pretty_assertions/src/lib.rs | 14 +++++++------- pretty_assertions/tests/macros.rs | 2 +- scripts/check | 7 +++++-- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/pretty_assertions/Cargo.toml b/pretty_assertions/Cargo.toml index c3384b0..e2c3351 100644 --- a/pretty_assertions/Cargo.toml +++ b/pretty_assertions/Cargo.toml @@ -18,9 +18,15 @@ keywords = ["assert", "diff", "pretty", "color"] readme = "README.md" [features] -default = [] +default = ["std"] -# Enable unstable features requiring nightly rustc +# Use the Rust standard library. +# Exactly one of `std` and `alloc` is required. +std = [] +# Use the `alloc` crate. +# Exactly one of `std` and `alloc` is required. +alloc = [] +# Enable unstable features. Requires nightly rustc. unstable = [] [dependencies] @@ -31,12 +37,3 @@ diff = "0.1.12" output_vt100 = "0.1.2" ctor = "0.1.9" -[features] -default = ["std"] - -# Use the Rust standard library. -# Exactly one of `std` and `alloc` is required. -std = [] -# Use the `alloc` crate. -# Exactly one of `std` and `alloc` is required. -alloc = [] diff --git a/pretty_assertions/src/lib.rs b/pretty_assertions/src/lib.rs index 96e538a..beead99 100644 --- a/pretty_assertions/src/lib.rs +++ b/pretty_assertions/src/lib.rs @@ -239,7 +239,7 @@ macro_rules! assert_ne { /// On panic, this macro will print a diff derived from [`Debug`] representation of /// the value, and a string representation of the pattern. /// -/// This is a drop in replacement for [`std::assert_matches::assert_matches!`]. +/// This is a drop in replacement for [`core::assert_matches::assert_matches!`]. /// You can provide a custom panic message if desired. /// /// # Examples @@ -269,7 +269,7 @@ macro_rules! assert_matches { $crate::assert_matches!( @ left_val, - ::std::stringify!($($pattern)|+ $(if $guard)?), + ::core::stringify!($($pattern)|+ $(if $guard)?), "", "" ); @@ -283,7 +283,7 @@ macro_rules! assert_matches { $crate::assert_matches!( @ left_val, - ::std::stringify!($($pattern)|+ $(if $guard)?), + ::core::stringify!($($pattern)|+ $(if $guard)?), ": ", $($arg)+ ); @@ -297,13 +297,13 @@ macro_rules! assert_matches { // Use the Display implementation to display the pattern, // as using Debug would add another layer of quotes to the output. struct Pattern<'a>(&'a str); - impl ::std::fmt::Debug for Pattern<'_> { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::std::fmt::Display::fmt(self.0, f) + impl ::core::fmt::Debug for Pattern<'_> { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + ::core::fmt::Display::fmt(self.0, f) } } - ::std::panic!("assertion failed: `(left matches right)`{}{}\ + ::core::panic!("assertion failed: `(left matches right)`{}{}\ \n\ \n{}\ \n", diff --git a/pretty_assertions/tests/macros.rs b/pretty_assertions/tests/macros.rs index 26bb11e..3c34f02 100644 --- a/pretty_assertions/tests/macros.rs +++ b/pretty_assertions/tests/macros.rs @@ -202,7 +202,7 @@ mod assert_ne { #[cfg(feature = "unstable")] mod assert_matches { - use ::std::option::Option::{None, Some}; + use ::core::option::Option::{None, Some}; #[test] fn passes() { diff --git a/scripts/check b/scripts/check index c42d747..4638490 100755 --- a/scripts/check +++ b/scripts/check @@ -22,11 +22,14 @@ pushd pretty_assertions eprintln "Running tests (default)" cargo test -eprintln "Running tests (std)" -cargo test --no-default-features --features std eprintln "Running tests (alloc)" cargo test --no-default-features --features alloc +eprintln "Running tests (nightly) (unstable)" +cargo +nightly test --features unstable +eprintln "Running tests (nightly) (alloc, unstable)" +cargo +nightly test --no-default-features --features alloc --features unstable + popd eprintln "Running unit tests (unstable)"