Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7c489c3

Browse files
authored
Merge pull request#36 from dvdhrm/pr/nostd
nostd: remove left-overs from `no_std` feature flag
2 parentsfda272b +3a57d02 commit7c489c3

File tree

5 files changed

+8
-26
lines changed

5 files changed

+8
-26
lines changed

‎Cargo.toml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ compiler_builtins = { version = "0.1", optional = true }
2424

2525
[features]
2626
default = []
27-
no_std = []
2827
bench = []
2928
rustc-dep-of-std = ['std','core','compiler_builtins']
29+
30+
# Legacy, now a no-op
31+
no_std = []

‎scripts/unicode.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,6 @@ def emit_module(
422422
module.write(
423423
"""
424424
pub mod charwidth {
425-
use core::option::Option::{self, None, Some};
426-
427425
/// Returns the [UAX #11](https://www.unicode.org/reports/tr11/) based width of `c` by
428426
/// consulting a multi-level lookup table.
429427
/// If `is_cjk == true`, ambiguous width characters are treated as double width; otherwise,

‎src/lib.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
//!
3030
//! # features
3131
//!
32-
//! unicode-widthsupports a `no_std` feature. This eliminates dependence
33-
//!on std, and instead uses equivalent functions from core.
32+
//! unicode-widthdoes not depend on `std`, so it can be used in crates
33+
//!with the `#![no_std]` attribute.
3434
//!
3535
//! # crates.io
3636
//!

‎src/tables.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
pubconstUNICODE_VERSION:(u8,u8,u8) =(15,1,0);
1616

1717
pubmod charwidth{
18-
use core::option::Option::{self,None,Some};
19-
2018
/// Returns the [UAX #11](https://www.unicode.org/reports/tr11/) based width of `c` by
2119
/// consulting a multi-level lookup table.
2220
/// If `is_cjk == true`, ambiguous width characters are treated as double width; otherwise,

‎src/tests.rs‎

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use super::{UnicodeWidthChar, UnicodeWidthStr};
1313
#[cfg(feature ="bench")]
1414
use std::iter;
1515
#[cfg(feature ="bench")]
16-
use test::{self,Bencher};
16+
use test::Bencher;
1717

1818
use std::prelude::v1::*;
1919

@@ -93,15 +93,15 @@ fn simple_width_match(c: char) -> Option<usize> {
9393
_ =>UnicodeWidthChar::width(c),
9494
}
9595
}
96-
#[cfg(all(feature ="bench", not(feature ="no_std")))]
96+
#[cfg(feature ="bench")]
9797
#[bench]
9898
fnenwik8(b:&mutBencher){
9999
// To benchmark, download & unzip `enwik8` from https://data.deepai.org/enwik8.zip
100100
let data_path ="bench_data/enwik8";
101101
let string = std::fs::read_to_string(data_path).unwrap_or_default();
102102
b.iter(|| test::black_box(UnicodeWidthStr::width(string.as_str())));
103103
}
104-
#[cfg(all(feature ="bench", not(feature ="no_std")))]
104+
#[cfg(feature ="bench")]
105105
#[bench]
106106
fnjawiki(b:&mutBencher){
107107
// To benchmark, download & extract `jawiki-20220501-pages-articles-multistream-index.txt` from
@@ -140,8 +140,6 @@ fn test_emoji() {
140140
#[test]
141141
fntest_char(){
142142
usesuper::UnicodeWidthChar;
143-
#[cfg(feature ="no_std")]
144-
use core::option::Option::{None,Some};
145143

146144
assert_eq!(UnicodeWidthChar::width('h'),Some(2));
147145
assert_eq!('h'.width_cjk(),Some(2));
@@ -156,8 +154,6 @@ fn test_char() {
156154
#[test]
157155
fntest_char2(){
158156
usesuper::UnicodeWidthChar;
159-
#[cfg(feature ="no_std")]
160-
use core::option::Option::{None,Some};
161157

162158
assert_eq!(UnicodeWidthChar::width('\x00'),Some(0));
163159
assert_eq!('\x00'.width_cjk(),Some(0));
@@ -187,17 +183,13 @@ fn test_char2() {
187183
#[test]
188184
fnunicode_12(){
189185
usesuper::UnicodeWidthChar;
190-
#[cfg(feature ="no_std")]
191-
use core::option::Option::{None,Some};
192186

193187
assert_eq!(UnicodeWidthChar::width('\u{1F971}'),Some(2));
194188
}
195189

196190
#[test]
197191
fntest_default_ignorable(){
198192
usesuper::UnicodeWidthChar;
199-
#[cfg(feature ="no_std")]
200-
use core::option::Option::{None,Some};
201193

202194
assert_eq!(UnicodeWidthChar::width('\u{E0000}'),Some(0));
203195

@@ -209,8 +201,6 @@ fn test_default_ignorable() {
209201
#[test]
210202
fntest_jamo(){
211203
usesuper::UnicodeWidthChar;
212-
#[cfg(feature ="no_std")]
213-
use core::option::Option::{None,Some};
214204

215205
assert_eq!(UnicodeWidthChar::width('\u{1100}'),Some(2));
216206
assert_eq!(UnicodeWidthChar::width('\u{A97C}'),Some(2));
@@ -225,8 +215,6 @@ fn test_jamo() {
225215
#[test]
226216
fntest_prepended_concatenation_marks(){
227217
usesuper::UnicodeWidthChar;
228-
#[cfg(feature ="no_std")]
229-
use core::option::Option::{None,Some};
230218

231219
assert_eq!(UnicodeWidthChar::width('\u{0600}'),Some(1));
232220
assert_eq!(UnicodeWidthChar::width('\u{070F}'),Some(1));
@@ -237,8 +225,6 @@ fn test_prepended_concatenation_marks() {
237225
#[test]
238226
fntest_interlinear_annotation_chars(){
239227
usesuper::UnicodeWidthChar;
240-
#[cfg(feature ="no_std")]
241-
use core::option::Option::{None,Some};
242228

243229
assert_eq!(UnicodeWidthChar::width('\u{FFF9}'),Some(1));
244230
assert_eq!(UnicodeWidthChar::width('\u{FFFA}'),Some(1));
@@ -248,8 +234,6 @@ fn test_interlinear_annotation_chars() {
248234
#[test]
249235
fntest_hieroglyph_format_controls(){
250236
usesuper::UnicodeWidthChar;
251-
#[cfg(feature ="no_std")]
252-
use core::option::Option::{None,Some};
253237

254238
assert_eq!(UnicodeWidthChar::width('\u{13430}'),Some(1));
255239
assert_eq!(UnicodeWidthChar::width('\u{13436}'),Some(1));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp