Make Xilem Core unconditionally `no_std` (#877)

This removes the need to ignore `unused_qualifications`.

The `extern crate std` isn't *strictly* needed, but it will make future
debugging easier (you can do `println` or `dbg!`, for example).
This commit is contained in:
Daniel McNab 2025-02-24 16:21:58 +00:00 committed by GitHub
parent 24c18686ae
commit 8147465350
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 7 deletions

View File

@ -23,12 +23,16 @@
#![cfg_attr(target_pointer_width = "64", warn(clippy::trivially_copy_pass_by_ref))] #![cfg_attr(target_pointer_width = "64", warn(clippy::trivially_copy_pass_by_ref))]
// END LINEBENDER LINT SET // END LINEBENDER LINT SET
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg_attr(not(test), no_std)]
#![forbid(unsafe_code)] #![forbid(unsafe_code)]
#![no_std]
// TODO: Remove any items listed as "Deferred" // TODO: Remove any items listed as "Deferred"
#![expect(clippy::allow_attributes_without_reason, reason = "Deferred: Noisy")] #![expect(clippy::allow_attributes_without_reason, reason = "Deferred: Noisy")]
extern crate alloc; extern crate alloc;
// Used only for ad-hoc debugging of tests
#[cfg(test)]
extern crate std;
mod deferred; mod deferred;
pub use deferred::{AsyncCtx, MessageProxy, PhantomView, ProxyError, RawProxy}; pub use deferred::{AsyncCtx, MessageProxy, PhantomView, ProxyError, RawProxy};

View File

@ -122,6 +122,8 @@ pub trait ViewMessage<State, Action> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use alloc::boxed::Box; use alloc::boxed::Box;
use alloc::format;
use alloc::string::{String, ToString};
use core::fmt::Debug; use core::fmt::Debug;
use crate::DynMessage; use crate::DynMessage;

View File

@ -1,12 +1,6 @@
// Copyright 2024 the Xilem Authors // Copyright 2024 the Xilem Authors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
#![allow(
// TODO: Instead of being conditionally no_std, instead conditionally use `extern crate std`
unused_qualifications,
reason = "We have `std` enabled when testing, which means that some items are conditionally in the prelude"
)]
use crate::{ use crate::{
DynMessage, MessageResult, Mut, View, ViewElement, ViewId, ViewMarker, ViewPathTracker, DynMessage, MessageResult, Mut, View, ViewElement, ViewId, ViewMarker, ViewPathTracker,
}; };