Skip to content

Commit 8803440

Browse files
committed
Drop redundant use-declarations
The package is always compiled as `no_std` and pulls in `std` and `test` when compiling tests. Hence: - The prelude of `core` is available unconditionally, and it includes `core::options::Option` and its variants. No need to manually declare them. - The `test` crate is in-scope automatically, so no need to manually declare it.
1 parent 84a47fd commit 8803440

File tree

3 files changed

+1
-21
lines changed

3 files changed

+1
-21
lines changed

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/tables.rs

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

1717
pub mod 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: 1 addition & 17 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

@@ -140,8 +140,6 @@ fn test_emoji() {
140140
#[test]
141141
fn test_char() {
142142
use super::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
fn test_char2() {
158156
use super::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
fn unicode_12() {
189185
use super::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
fn test_default_ignorable() {
198192
use super::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
fn test_jamo() {
211203
use super::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
fn test_prepended_concatenation_marks() {
227217
use super::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
fn test_interlinear_annotation_chars() {
239227
use super::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
fn test_hieroglyph_format_controls() {
250236
use super::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)