Skip to content

Commit

Permalink
Make Xilem Core unconditionally no_std (#877)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
DJMcNab authored Feb 24, 2025
1 parent 24c1868 commit 8147465
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 5 additions & 1 deletion xilem_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@
#![cfg_attr(target_pointer_width = "64", warn(clippy::trivially_copy_pass_by_ref))]
// END LINEBENDER LINT SET
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg_attr(not(test), no_std)]
#![forbid(unsafe_code)]
#![no_std]
// TODO: Remove any items listed as "Deferred"
#![expect(clippy::allow_attributes_without_reason, reason = "Deferred: Noisy")]
extern crate alloc;

// Used only for ad-hoc debugging of tests
#[cfg(test)]
extern crate std;

mod deferred;
pub use deferred::{AsyncCtx, MessageProxy, PhantomView, ProxyError, RawProxy};

Expand Down
2 changes: 2 additions & 0 deletions xilem_core/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ pub trait ViewMessage<State, Action> {
#[cfg(test)]
mod tests {
use alloc::boxed::Box;
use alloc::format;
use alloc::string::{String, ToString};
use core::fmt::Debug;

use crate::DynMessage;
Expand Down
6 changes: 0 additions & 6 deletions xilem_core/src/views/orphan.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// Copyright 2024 the Xilem Authors
// 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::{
DynMessage, MessageResult, Mut, View, ViewElement, ViewId, ViewMarker, ViewPathTracker,
};
Expand Down

0 comments on commit 8147465

Please sign in to comment.