Skip to content

Commit 77ef1c8

Browse files
committed
Revert "time: make it no_std compatible with a setter as there is no now() method in the no_std world :("
This reverts commit efca948.
1 parent efca948 commit 77ef1c8

File tree

11 files changed

+18
-52
lines changed

11 files changed

+18
-52
lines changed

crates/nostr/src/event/kind.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33

44
//! Kind
55
6-
use core::num::ParseIntError;
7-
8-
#[cfg(feature = "alloc")]
9-
use alloc::{fmt, str::FromStr};
10-
11-
#[cfg(feature = "std")]
12-
use std::{fmt, str::FromStr};
6+
use std::fmt;
7+
use std::num::ParseIntError;
8+
use std::str::FromStr;
139

1410
use serde::de::{Deserialize, Deserializer, Error, Visitor};
1511
use serde::ser::{Serialize, Serializer};

crates/nostr/src/event/tag.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
//! Tag
55
6-
#[cfg(feature = "alloc")]
7-
use alloc::{vec::Vec, string::String};
8-
96
use std::fmt;
107
use std::num::ParseIntError;
118
use std::str::FromStr;

crates/nostr/src/lib.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Copyright (c) 2022-2023 Yuki Kishimoto
22
// Distributed under the MIT software license
33

4+
#![cfg_attr(not(feature = "std"), no_std)]
5+
6+
#[cfg(not(feature = "debug"))]
7+
extern crate alloc;
48

59

610

@@ -14,14 +18,6 @@
1418
doc = include_str!("../README.md")
1519
)]
1620

17-
#![cfg_attr(not(feature = "std"), no_std)]
18-
19-
#[cfg(feature = "alloc")]
20-
extern crate alloc;
21-
22-
#[cfg(feature = "alloc")]
23-
use alloc::boxed::Box;
24-
2521
#[macro_use]
2622
pub extern crate serde;
2723

@@ -49,4 +45,4 @@ pub use self::message::{ClientMessage, Filter, RelayMessage, SubscriptionId};
4945
pub use self::types::{ChannelId, Contact, Entity, Metadata, Profile, Timestamp};
5046

5147
/// Result
52-
pub type Result<T, E = Box<dyn std::error::Error>> = std::result::Result<T, E>;
48+
pub type Result<T, E = alloc::boxed::Box<dyn std::error::Error>> = std::result::Result<T, E>;

crates/nostr/src/message/client.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
//! Client messages
66
7-
#[cfg(feature = "alloc")]
8-
use alloc::{string::String, vec, vec::Vec};
9-
107
use serde::de::Error;
118
use serde::{Deserialize, Deserializer, Serialize, Serializer};
129
use serde_json::{json, Value};

crates/nostr/src/message/relay.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
//! Relay messages
66
7-
#[cfg(feature = "alloc")]
8-
use alloc::string::String;
9-
107
use serde::de::Error;
118
use serde::{Deserialize, Deserializer, Serialize, Serializer};
129
use serde_json::{json, Value};

crates/nostr/src/message/subscription.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@
66
77
#![allow(missing_docs)]
88

9-
#[cfg(feature = "std")]
109
use std::fmt;
1110

12-
#[cfg(feature = "alloc")]
13-
use alloc::{fmt, vec::Vec, string::String};
14-
1511
use bitcoin_hashes::sha256::Hash as Sha256Hash;
1612
use bitcoin_hashes::Hash;
1713
use secp256k1::rand::rngs::OsRng;

crates/nostr/src/types/channel_id.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
//! Channel Id
55
6-
#[cfg(feature = "alloc")]
7-
use alloc::{vec::Vec, string::String};
8-
96
use std::fmt;
107

118
#[cfg(feature = "nip19")]

crates/nostr/src/types/contact.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
//! Contact
55
6-
#[cfg(feature = "alloc")]
7-
use alloc::string::String;
8-
96
use secp256k1::XOnlyPublicKey;
107

118
/// Contact

crates/nostr/src/types/metadata.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
66
use url::Url;
77

8-
#[cfg(feature = "alloc")]
98
use alloc::string::String;
109

1110
/// [`Metadata`] error

crates/nostr/src/types/profile.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ use secp256k1::XOnlyPublicKey;
99

1010
#[cfg(feature = "nip19")]
1111
use crate::nips::nip19::{Error, FromBech32, ToBech32, PREFIX_BECH32_PROFILE, RELAY, SPECIAL};
12-
13-
#[cfg(feature = "alloc")]
14-
use alloc::{string::String, vec::Vec};
12+
use alloc::vec::Vec;
13+
use alloc::string::String;
1514

1615
/// Profile
1716
#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Serialize, Deserialize)]

0 commit comments

Comments
 (0)