diff options
| author | Corey Farwell <coreyf@rwell.org> | 2014-11-28 11:57:41 -0500 |
|---|---|---|
| committer | Corey Farwell <coreyf@rwell.org> | 2014-12-05 18:13:04 -0500 |
| commit | 4ef16741e355754abd446acbd80e5afb784864c7 (patch) | |
| tree | bfe4f64de5b3bcf88672424d0f66b5ad12fe7054 /src/etc | |
| parent | 6f4c11be3b9706d1ba0e1b74b89de1478410a56f (diff) | |
| download | rust-4ef16741e355754abd446acbd80e5afb784864c7.tar.gz rust-4ef16741e355754abd446acbd80e5afb784864c7.zip | |
Utilize fewer reexports
In regards to: https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729 This commit: * Changes the #deriving code so that it generates code that utilizes fewer reexports (in particur Option::* and Result::*), which is necessary to remove those reexports in the future * Changes other areas of the codebase so that fewer reexports are utilized
Diffstat (limited to 'src/etc')
| -rwxr-xr-x | src/etc/unicode.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/etc/unicode.py b/src/etc/unicode.py index 15263919fb9..20edf9418f1 100755 --- a/src/etc/unicode.py +++ b/src/etc/unicode.py @@ -292,7 +292,7 @@ def escape_char(c): def emit_bsearch_range_table(f): f.write(""" fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool { - use core::cmp::{Equal, Less, Greater}; + use core::cmp::Ordering::{Equal, Less, Greater}; use core::slice::SlicePrelude; r.binary_search(|&(lo,hi)| { if lo <= c && c <= hi { Equal } @@ -350,10 +350,11 @@ def emit_regex_module(f, cats, w_data): def emit_conversions_module(f, lowerupper, upperlower): f.write("pub mod conversions {") f.write(""" - use core::cmp::{Equal, Less, Greater}; + use core::cmp::Ordering::{Equal, Less, Greater}; use core::slice::SlicePrelude; use core::tuple::Tuple2; - use core::option::{Option, Some, None}; + use core::option::Option; + use core::option::Option::{Some, None}; use core::slice; pub fn to_lower(c: char) -> char { @@ -403,7 +404,7 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats): f.write(""" } fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat { - use core::cmp::{Equal, Less, Greater}; + use core::cmp::Ordering::{Equal, Less, Greater}; match r.binary_search(|&(lo, hi, _)| { if lo <= c && c <= hi { Equal } else if hi < c { Less } @@ -430,12 +431,13 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats): def emit_charwidth_module(f, width_table): f.write("pub mod charwidth {\n") - f.write(" use core::option::{Option, Some, None};\n") + f.write(" use core::option::Option;\n") + f.write(" use core::option::Option::{Some, None};\n") f.write(" use core::slice::SlicePrelude;\n") f.write(" use core::slice;\n") f.write(""" fn bsearch_range_value_table(c: char, is_cjk: bool, r: &'static [(char, char, u8, u8)]) -> u8 { - use core::cmp::{Equal, Less, Greater}; + use core::cmp::Ordering::{Equal, Less, Greater}; match r.binary_search(|&(lo, hi, _, _)| { if lo <= c && c <= hi { Equal } else if hi < c { Less } @@ -530,7 +532,7 @@ def emit_norm_module(f, canon, compat, combine, norm_props): f.write(""" fn bsearch_range_value_table(c: char, r: &'static [(char, char, u8)]) -> u8 { - use core::cmp::{Equal, Less, Greater}; + use core::cmp::Ordering::{Equal, Less, Greater}; use core::slice::SlicePrelude; use core::slice; match r.binary_search(|&(lo, hi, _)| { |
