Skip to content

Commit

Permalink
Formatting of affected files
Browse files Browse the repository at this point in the history
  • Loading branch information
target-san committed Oct 6, 2024
1 parent 1eb50fe commit 9031491
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
4 changes: 3 additions & 1 deletion proptest/src/test_runner/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ impl fmt::Display for TestCaseError {
TestCaseError::Reject(ref whence) => {
write!(f, "Input rejected at {}", whence)
}
TestCaseError::Fail(ref why) => write!(f, "Case failed: {}", why.display_detailed()),
TestCaseError::Fail(ref why) => {
write!(f, "Case failed: {}", why.display_detailed())
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion proptest/src/test_runner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
//! You do not normally need to access things in this module directly except
//! when implementing new low-level strategies.

mod backtrace;
mod config;
mod errors;
mod failure_persistence;
Expand All @@ -22,7 +23,6 @@ mod result_cache;
mod rng;
mod runner;
mod scoped_panic_hook;
mod backtrace;

pub use self::config::*;
pub use self::errors::*;
Expand Down
15 changes: 10 additions & 5 deletions proptest/src/test_runner/reason.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ impl Reason {
Self(message.into(), Backtrace::empty())
}
/// Creates reason from provided message, adding location info as its part
///
///
/// # Parameters
/// * `message` - anything convertible to shared or owned string
///
///
/// # Returns
/// Reason object
#[track_caller]
Expand All @@ -60,7 +60,9 @@ impl Reason {
/// Reason object with provided message, augmented with location info, and captured backtrace
#[inline(always)]
#[track_caller]
pub fn with_location_and_backtrace(message: impl Into<Cow<'static, str>>) -> Self {
pub fn with_location_and_backtrace(
message: impl Into<Cow<'static, str>>,
) -> Self {
Self(Self::with_location(message).0, Backtrace::capture())
}
/// Return the message for this `Reason`.
Expand Down Expand Up @@ -132,10 +134,13 @@ impl<'a, 'b> From<&'b std::panic::PanicInfo<'a>> for Reason {
#[inline(always)]
fn from(value: &'b std::panic::PanicInfo<'a>) -> Self {
let payload = value.payload();
let message: String = payload.downcast_ref::<&'static str>()
let message: String = payload
.downcast_ref::<&'static str>()
.map(|s| s.to_string())
.or_else(|| payload.downcast_ref::<String>().map(|s| s.clone()))
.or_else(|| payload.downcast_ref::<Box<str>>().map(|s| s.to_string()))
.or_else(|| {
payload.downcast_ref::<Box<str>>().map(|s| s.to_string())
})
.unwrap_or_else(|| "<unknown panic value>".to_string());

let message = if let Some(loc) = value.location() {
Expand Down
2 changes: 1 addition & 1 deletion proptest/src/test_runner/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ impl TestRunner {
INFO_LOG,
"Shrinking disabled by configuration"
);
return None
return None;
}

#[cfg(feature = "std")]
Expand Down

0 comments on commit 9031491

Please sign in to comment.