bevy_ecs: remove use of needless_return (#19859)
# Objective - bevy_ecs has a expected lint that is both needed and unneeded ## Solution - Change the logic so that it's always not needed ## Testing `cargo clippy -p bevy_ecs --no-default-features --no-deps -- -D warnings`
This commit is contained in:
parent
8e12b1f0b2
commit
1fe559730c
@ -64,32 +64,23 @@ impl<const SEND: bool> ResourceData<SEND> {
|
|||||||
/// If `SEND` is false, this will panic if called from a different thread than the one it was inserted from.
|
/// If `SEND` is false, this will panic if called from a different thread than the one it was inserted from.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn validate_access(&self) {
|
fn validate_access(&self) {
|
||||||
if SEND {
|
if !SEND {
|
||||||
#[cfg_attr(
|
#[cfg(feature = "std")]
|
||||||
not(feature = "std"),
|
if self.origin_thread_id != Some(std::thread::current().id()) {
|
||||||
expect(
|
// Panic in tests, as testing for aborting is nearly impossible
|
||||||
clippy::needless_return,
|
panic!(
|
||||||
reason = "needless until no_std is addressed (see below)",
|
"Attempted to access or drop non-send resource {} from thread {:?} on a thread {:?}. This is not allowed. Aborting.",
|
||||||
)
|
self.type_name,
|
||||||
)]
|
self.origin_thread_id,
|
||||||
return;
|
std::thread::current().id()
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
// TODO: Handle no_std non-send.
|
||||||
if self.origin_thread_id != Some(std::thread::current().id()) {
|
// Currently, no_std is single-threaded only, so this is safe to ignore.
|
||||||
// Panic in tests, as testing for aborting is nearly impossible
|
// To support no_std multithreading, an alternative will be required.
|
||||||
panic!(
|
// Remove the #[expect] attribute above when this is addressed.
|
||||||
"Attempted to access or drop non-send resource {} from thread {:?} on a thread {:?}. This is not allowed. Aborting.",
|
|
||||||
self.type_name,
|
|
||||||
self.origin_thread_id,
|
|
||||||
std::thread::current().id()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Handle no_std non-send.
|
|
||||||
// Currently, no_std is single-threaded only, so this is safe to ignore.
|
|
||||||
// To support no_std multithreading, an alternative will be required.
|
|
||||||
// Remove the #[expect] attribute above when this is addressed.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if the resource is populated.
|
/// Returns true if the resource is populated.
|
||||||
|
Loading…
Reference in New Issue
Block a user