Skip to content

Commit

Permalink
Format with rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Dec 26, 2023
1 parent 1a5f7c8 commit ad30865
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 10 deletions.
6 changes: 5 additions & 1 deletion src/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ macro_rules! backtrace_if_absent {
};
}

#[cfg(all(feature = "std", not(error_generic_member_access), any(std_backtrace, feature = "backtrace")))]
#[cfg(all(
feature = "std",
not(error_generic_member_access),
any(std_backtrace, feature = "backtrace")
))]
macro_rules! backtrace_if_absent {
($err:expr) => {
backtrace!()
Expand Down
45 changes: 36 additions & 9 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ impl Error {
#[cfg(anyhow_no_ptr_addr_of)]
object_downcast_mut: object_downcast_mut::<E>,
object_drop_rest: object_drop_front::<E>,
#[cfg(all(not(error_generic_member_access), any(std_backtrace, feature = "backtrace")))]
#[cfg(all(
not(error_generic_member_access),
any(std_backtrace, feature = "backtrace")
))]
object_backtrace: no_backtrace,
};

Expand All @@ -124,7 +127,10 @@ impl Error {
#[cfg(anyhow_no_ptr_addr_of)]
object_downcast_mut: object_downcast_mut::<M>,
object_drop_rest: object_drop_front::<M>,
#[cfg(all(not(error_generic_member_access), any(std_backtrace, feature = "backtrace")))]
#[cfg(all(
not(error_generic_member_access),
any(std_backtrace, feature = "backtrace")
))]
object_backtrace: no_backtrace,
};

Expand All @@ -150,7 +156,10 @@ impl Error {
#[cfg(anyhow_no_ptr_addr_of)]
object_downcast_mut: object_downcast_mut::<M>,
object_drop_rest: object_drop_front::<M>,
#[cfg(all(not(error_generic_member_access), any(std_backtrace, feature = "backtrace")))]
#[cfg(all(
not(error_generic_member_access),
any(std_backtrace, feature = "backtrace")
))]
object_backtrace: no_backtrace,
};

Expand Down Expand Up @@ -178,7 +187,10 @@ impl Error {
#[cfg(anyhow_no_ptr_addr_of)]
object_downcast_mut: context_downcast_mut::<C, E>,
object_drop_rest: context_drop_rest::<C, E>,
#[cfg(all(not(error_generic_member_access), any(std_backtrace, feature = "backtrace")))]
#[cfg(all(
not(error_generic_member_access),
any(std_backtrace, feature = "backtrace")
))]
object_backtrace: no_backtrace,
};

Expand All @@ -204,7 +216,10 @@ impl Error {
#[cfg(anyhow_no_ptr_addr_of)]
object_downcast_mut: object_downcast_mut::<Box<dyn StdError + Send + Sync>>,
object_drop_rest: object_drop_front::<Box<dyn StdError + Send + Sync>>,
#[cfg(all(not(error_generic_member_access), any(std_backtrace, feature = "backtrace")))]
#[cfg(all(
not(error_generic_member_access),
any(std_backtrace, feature = "backtrace")
))]
object_backtrace: no_backtrace,
};

Expand Down Expand Up @@ -317,7 +332,10 @@ impl Error {
#[cfg(anyhow_no_ptr_addr_of)]
object_downcast_mut: context_chain_downcast_mut::<C>,
object_drop_rest: context_chain_drop_rest::<C>,
#[cfg(all(not(error_generic_member_access), any(std_backtrace, feature = "backtrace")))]
#[cfg(all(
not(error_generic_member_access),
any(std_backtrace, feature = "backtrace")
))]
object_backtrace: context_backtrace::<C>,
};

Expand Down Expand Up @@ -598,7 +616,10 @@ struct ErrorVTable {
#[cfg(anyhow_no_ptr_addr_of)]
object_downcast_mut: unsafe fn(Mut<ErrorImpl>, TypeId) -> Option<Mut<()>>,
object_drop_rest: unsafe fn(Own<ErrorImpl>, TypeId),
#[cfg(all(not(error_generic_member_access), any(std_backtrace, feature = "backtrace")))]
#[cfg(all(
not(error_generic_member_access),
any(std_backtrace, feature = "backtrace")
))]
object_backtrace: unsafe fn(Ref<ErrorImpl>) -> Option<&Backtrace>,
}

Expand Down Expand Up @@ -703,7 +724,10 @@ where
}
}

#[cfg(all(not(error_generic_member_access), any(std_backtrace, feature = "backtrace")))]
#[cfg(all(
not(error_generic_member_access),
any(std_backtrace, feature = "backtrace")
))]
fn no_backtrace(e: Ref<ErrorImpl>) -> Option<&Backtrace> {
let _ = e;
None
Expand Down Expand Up @@ -824,7 +848,10 @@ where
}

// Safety: requires layout of *e to match ErrorImpl<ContextError<C, Error>>.
#[cfg(all(not(error_generic_member_access), any(std_backtrace, feature = "backtrace")))]
#[cfg(all(
not(error_generic_member_access),
any(std_backtrace, feature = "backtrace")
))]
#[allow(clippy::unnecessary_wraps)]
unsafe fn context_backtrace<C>(e: Ref<ErrorImpl>) -> Option<&Backtrace>
where
Expand Down

0 comments on commit ad30865

Please sign in to comment.