Skip to content

Commit

Permalink
[fixup] rebase on main, intersection with unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
tommilligan committed Sep 13, 2021
1 parent 60cf199 commit a2ef319
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
19 changes: 8 additions & 11 deletions pretty_assertions/Cargo.toml
Expand Up @@ -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]
Expand All @@ -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 = []
14 changes: 7 additions & 7 deletions pretty_assertions/src/lib.rs
Expand Up @@ -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
Expand Down Expand Up @@ -269,7 +269,7 @@ macro_rules! assert_matches {
$crate::assert_matches!(
@
left_val,
::std::stringify!($($pattern)|+ $(if $guard)?),
::core::stringify!($($pattern)|+ $(if $guard)?),
"",
""
);
Expand All @@ -283,7 +283,7 @@ macro_rules! assert_matches {
$crate::assert_matches!(
@
left_val,
::std::stringify!($($pattern)|+ $(if $guard)?),
::core::stringify!($($pattern)|+ $(if $guard)?),
": ",
$($arg)+
);
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion pretty_assertions/tests/macros.rs
Expand Up @@ -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() {
Expand Down
7 changes: 5 additions & 2 deletions scripts/check
Expand Up @@ -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)"
Expand Down

0 comments on commit a2ef319

Please sign in to comment.