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
This commit is contained in:
@@ -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, _)| {
|
||||
|
||||
Reference in New Issue
Block a user