From c390af2b369d5dd2f25c4de57c1a46a27467be61 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 13 Nov 2024 10:50:25 +0100 Subject: [PATCH] jid: Remove the std feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since Rust 1.81, std::error::Error has been moved to core::error::Error, which we can use without depending on std. --- jid/Cargo.toml | 3 +-- jid/src/error.rs | 5 +---- jid/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/jid/Cargo.toml b/jid/Cargo.toml index 3559d2cba596e2baffde78085e1cd5ac941c7f25..dcb93750acf3f86d124c7c3ddd63143be3ac0f17 100644 --- a/jid/Cargo.toml +++ b/jid/Cargo.toml @@ -32,6 +32,5 @@ serde_test = "1" jid = { path = ".", features = [ "serde" ] } [features] -default = ["std"] -std = [] +default = [] quote = ["dep:quote", "dep:proc-macro2"] diff --git a/jid/src/error.rs b/jid/src/error.rs index a954931a43d84bc263ffc09a6fd0a278a2ec5ce3..63a23ebbb8fb69ccd26fd6d202808c00c8dbb203 100644 --- a/jid/src/error.rs +++ b/jid/src/error.rs @@ -9,8 +9,6 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. use core::fmt; -#[cfg(feature = "std")] -use std::error::Error as StdError; /// An error that signifies that a `Jid` cannot be parsed from a string. #[derive(Debug, PartialEq, Eq)] @@ -50,8 +48,7 @@ pub enum Error { ResourceInBareJid, } -#[cfg(feature = "std")] -impl StdError for Error {} +impl core::error::Error for Error {} impl fmt::Display for Error { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { diff --git a/jid/src/lib.rs b/jid/src/lib.rs index b8b2c91607859308a69101eed5dc2f8a8cf47cad..6128196d11636c82ec736812d2d69d40483c09a9 100644 --- a/jid/src/lib.rs +++ b/jid/src/lib.rs @@ -34,7 +34,7 @@ extern crate alloc; -#[cfg(any(feature = "std", test))] +#[cfg(test)] extern crate std; use alloc::borrow::Cow;