Skip to content

Commit 92838fd

Browse files
committed
Make this crate no_std
As nothing actually depends on std, there is no need to keep a dependency on it. This allows users such as the jid crate to actually be no_std as well. Now that core::error::Error got stabilized, we don’t need anything from std any longer, but this bumps the minimum supported Rust version to 1.81.0.
1 parent 97e2588 commit 92838fd

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
- uses: actions/checkout@v3
5555
- uses: sfackler/actions/rustup@master
5656
with:
57-
version: 1.56.0
57+
version: 1.81.0
5858
- run: echo "version=$(rustc --version)" >> $GITHUB_OUTPUT
5959
id: rust-version
6060
- uses: actions/cache@v3

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ license = "MIT/Apache-2.0"
66
description = "An implementation of the stringprep algorithm"
77
repository = "https://github.com/sfackler/rust-stringprep"
88
readme = "README.md"
9+
rust-version = "1.81.0" # For core::error::Error
910

1011
[dependencies]
1112
unicode-bidi = "0.3"

src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
//! An implementation of the "stringprep" algorithm defined in [RFC 3454][].
22
//!
33
//! [RFC 3454]: https://tools.ietf.org/html/rfc3454
4+
#![no_std]
45
#![warn(missing_docs)]
6+
extern crate alloc;
57
extern crate unicode_bidi;
68
extern crate unicode_normalization;
79
extern crate unicode_properties;
810

9-
use std::borrow::Cow;
10-
use std::fmt;
11+
use alloc::borrow::Cow;
12+
use alloc::string::String;
13+
use core::fmt;
1114
use unicode_normalization::UnicodeNormalization;
1215
use unicode_properties::{GeneralCategoryGroup, UnicodeGeneralCategory};
1316

@@ -44,7 +47,7 @@ impl fmt::Display for Error {
4447
}
4548
}
4649

47-
impl std::error::Error for Error {}
50+
impl core::error::Error for Error {}
4851

4952
/// Prepares a string with the SASLprep profile of the stringprep algorithm.
5053
///

src/tables.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Character Tables
2-
use std::cmp::Ordering;
3-
use std::str::Chars;
2+
use core::cmp::Ordering;
3+
use core::str::Chars;
44
use unicode_bidi::{bidi_class, BidiClass};
55
use unicode_properties::{GeneralCategoryGroup, UnicodeGeneralCategory};
66

0 commit comments

Comments
 (0)