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

Fixed unused imports and deprecated pattern warnings#93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Manishearth merged 3 commits intounicode-rs:masterfromYohDeadfall:fixed-warnings
Mar 22, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionsCargo.toml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@ name = "unicode-segmentation"
version = "1.7.1"
authors = ["kwantam <kwantam@gmail.com>", "Manish Goregaokar <manishsmail@gmail.com>"]

edition = "2018"
homepage = "https://github.com/unicode-rs/unicode-segmentation"
repository = "https://github.com/unicode-rs/unicode-segmentation"
documentation = "https://unicode-rs.github.io/unicode-segmentation"
Expand Down
5 changes: 2 additions & 3 deletionsscripts/unicode.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -229,7 +229,7 @@ def emit_util_mod(f):
#[inline]
fn is_alphabetic(c: char) -> bool {
match c {
'a' ... 'z' | 'A' ... 'Z' => true,
'a' ..= 'z' | 'A' ..= 'Z' => true,
c if c > '\x7f' => super::derived_property::Alphabetic(c),
_ => false,
}
Expand All@@ -238,7 +238,7 @@ def emit_util_mod(f):
#[inline]
fn is_numeric(c: char) -> bool {
match c {
'0' ... '9' => true,
'0' ..= '9' => true,
c if c > '\x7f' => super::general_category::N(c),
_ => false,
}
Expand DownExpand Up@@ -281,7 +281,6 @@ def emit_break_module(f, break_table, break_cats, name):
f.write(""" }
fn bsearch_range_value_table(c: char, r: &'static [(char, char, %sCat)]) -> (u32, u32, %sCat) {
use core;
use core::cmp::Ordering::{Equal, Less, Greater};
match r.binary_search_by(|&(lo, hi, _)| {
if lo <= c && c <= hi { Equal }
Expand Down
16 changes: 8 additions & 8 deletionssrc/grapheme.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,7 @@

use core::cmp;

use tables::grapheme::GraphemeCat;
usecrate::tables::grapheme::GraphemeCat;

/// External iterator for grapheme clusters and byte offsets.
///
Expand DownExpand Up@@ -229,7 +229,7 @@ enum PairResult {
}

fncheck_pair(before:GraphemeCat,after:GraphemeCat) ->PairResult{
use tables::grapheme::GraphemeCat::*;
usecrate::tables::grapheme::GraphemeCat::*;
useself::PairResult::*;
match(before, after){
(GC_CR,GC_LF) =>NotBreak,// GB3
Expand DownExpand Up@@ -295,8 +295,8 @@ impl GraphemeCursor {
}

fngrapheme_category(&mutself,ch:char) ->GraphemeCat{
use tables::graphemeas gr;
use tables::grapheme::GraphemeCat::*;
usecrate::tables::graphemeas gr;
usecrate::tables::grapheme::GraphemeCat::*;

if ch <='\u{7e}'{
// Special-case optimization for ascii, except U+007F. This
Expand DownExpand Up@@ -387,7 +387,7 @@ impl GraphemeCursor {
/// assert_eq!(cursor.is_boundary(&flags[8..], 8), Ok(true));
/// ```
pubfnprovide_context(&mutself,chunk:&str,chunk_start:usize){
use tables::graphemeas gr;
usecrate::tables::graphemeas gr;
assert!(chunk_start + chunk.len() ==self.pre_context_offset.unwrap());
self.pre_context_offset =None;
ifself.is_extended && chunk_start + chunk.len() ==self.offset{
Expand DownExpand Up@@ -433,7 +433,7 @@ impl GraphemeCursor {
}

fnhandle_regional(&mutself,chunk:&str,chunk_start:usize){
use tables::graphemeas gr;
usecrate::tables::graphemeas gr;
letmut ris_count =self.ris_count.unwrap_or(0);
for chin chunk.chars().rev(){
ifself.grapheme_category(ch) != gr::GC_Regional_Indicator{
Expand All@@ -453,7 +453,7 @@ impl GraphemeCursor {
}

fnhandle_emoji(&mutself,chunk:&str,chunk_start:usize){
use tables::graphemeas gr;
usecrate::tables::graphemeas gr;
letmut iter = chunk.chars().rev();
ifletSome(ch) = iter.next(){
ifself.grapheme_category(ch) != gr::GC_ZWJ{
Expand DownExpand Up@@ -506,7 +506,7 @@ impl GraphemeCursor {
/// assert_eq!(cursor.is_boundary(flags, 0), Ok(false));
/// ```
pubfnis_boundary(&mutself,chunk:&str,chunk_start:usize) ->Result<bool,GraphemeIncomplete>{
use tables::graphemeas gr;
usecrate::tables::graphemeas gr;
ifself.state ==GraphemeState::Break{
returnOk(true)
}
Expand Down
8 changes: 4 additions & 4 deletionssrc/sentence.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,7 @@ use core::iter::Filter;

// All of the logic for forward iteration over sentences
mod fwd{
use tables::sentence::SentenceCat;
usecrate::tables::sentence::SentenceCat;
use core::cmp;

// Describe a parsed part of source string as described in this table:
Expand DownExpand Up@@ -111,7 +111,7 @@ mod fwd {
if parts[idx] ==StatePart::ClosePlus{ idx -=1}

if parts[idx] ==StatePart::ATerm{
use tables::sentenceas se;
usecrate::tables::sentenceas se;

for next_charin ahead.chars(){
//( ¬(OLetter | Upper | Lower | ParaSep | SATerm) )* Lower
Expand DownExpand Up@@ -176,7 +176,7 @@ mod fwd {

#[inline]
fnnext(&mutself) ->Option<usize>{
use tables::sentenceas se;
usecrate::tables::sentenceas se;

for next_charinself.string[self.pos..].chars(){
let position_before =self.pos;
Expand DownExpand Up@@ -331,7 +331,7 @@ pub fn new_sentence_bound_indices<'a>(source: &'a str) -> USentenceBoundIndices<
#[inline]
pubfnnew_unicode_sentences<'b>(s:&'bstr) ->UnicodeSentences<'b>{
usesuper::UnicodeSegmentation;
use tables::util::is_alphanumeric;
usecrate::tables::util::is_alphanumeric;

fnhas_alphanumeric(s:&&str) ->bool{ s.chars().any(|c|is_alphanumeric(c))}
let has_alphanumeric:fn(&&str) ->bool = has_alphanumeric;// coerce to fn pointer
Expand Down
8 changes: 2 additions & 6 deletionssrc/tables.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,7 +30,7 @@ pub mod util {
#[inline]
fnis_alphabetic(c:char) ->bool{
match c{
'a' ...'z' |'A' ...'Z' =>true,
'a' ..='z' |'A' ..='Z' =>true,
cif c >'' =>super::derived_property::Alphabetic(c),
_ =>false,
}
Expand All@@ -39,7 +39,7 @@ pub mod util {
#[inline]
fnis_numeric(c:char) ->bool{
match c{
'0' ...'9' =>true,
'0' ..='9' =>true,
cif c >'' =>super::general_category::N(c),
_ =>false,
}
Expand DownExpand Up@@ -352,7 +352,6 @@ pub mod grapheme {
}

fnbsearch_range_value_table(c:char,r:&'static[(char,char,GraphemeCat)]) ->(u32,u32,GraphemeCat){
use core;
use core::cmp::Ordering::{Equal,Less,Greater};
match r.binary_search_by(|&(lo, hi, _)|{
if lo <= c && c <= hi{Equal}
Expand DownExpand Up@@ -1003,7 +1002,6 @@ pub mod word {
}

fnbsearch_range_value_table(c:char,r:&'static[(char,char,WordCat)]) ->(u32,u32,WordCat){
use core;
use core::cmp::Ordering::{Equal,Less,Greater};
match r.binary_search_by(|&(lo, hi, _)|{
if lo <= c && c <= hi{Equal}
Expand DownExpand Up@@ -1479,7 +1477,6 @@ pub mod emoji {
}

fnbsearch_range_value_table(c:char,r:&'static[(char,char,EmojiCat)]) ->(u32,u32,EmojiCat){
use core;
use core::cmp::Ordering::{Equal,Less,Greater};
match r.binary_search_by(|&(lo, hi, _)|{
if lo <= c && c <= hi{Equal}
Expand DownExpand Up@@ -1583,7 +1580,6 @@ pub mod sentence {
}

fnbsearch_range_value_table(c:char,r:&'static[(char,char,SentenceCat)]) ->(u32,u32,SentenceCat){
use core;
use core::cmp::Ordering::{Equal,Less,Greater};
match r.binary_search_by(|&(lo, hi, _)|{
if lo <= c && c <= hi{Equal}
Expand Down
6 changes: 3 additions & 3 deletionssrc/test.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,7 @@ use std::prelude::v1::*;

#[test]
fn test_graphemes() {
use testdata::{TEST_SAME, TEST_DIFF};
usecrate::testdata::{TEST_SAME, TEST_DIFF};

pub const EXTRA_DIFF: &'static [(&'static str,
&'static [&'static str],
Expand DownExpand Up@@ -88,7 +88,7 @@ fn test_graphemes() {

#[test]
fn test_words() {
use testdata::TEST_WORD;
usecrate::testdata::TEST_WORD;

// Unicode's official tests don't really test longer chains of flag emoji
// TODO This could be improved with more tests like flag emoji with interspersed Extend chars and ZWJ
Expand DownExpand Up@@ -144,7 +144,7 @@ fn test_words() {

#[test]
fn test_sentences() {
use testdata::TEST_SENTENCE;
usecrate::testdata::TEST_SENTENCE;

for &(s, w) in TEST_SENTENCE.iter() {
macro_rules! assert_ {
Expand Down
14 changes: 7 additions & 7 deletionssrc/word.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,7 +11,7 @@
use core::cmp;
use core::iter::Filter;

use tables::word::WordCat;
usecrate::tables::word::WordCat;

/// An iterator over the substrings of a string which, after splitting the string on
/// [word boundaries](http://www.unicode.org/reports/tr29/#Word_Boundaries),
Expand DownExpand Up@@ -170,7 +170,7 @@ enum RegionalState {
}

fn is_emoji(ch: char) -> bool {
use tables::emoji;
usecrate::tables::emoji;
emoji::emoji_category(ch).2 == emoji::EmojiCat::EC_Extended_Pictographic
}

Expand All@@ -187,7 +187,7 @@ impl<'a> Iterator for UWordBounds<'a> {
fn next(&mut self) -> Option<&'a str> {
use self::UWordBoundsState::*;
use self::FormatExtendType::*;
use tables::word as wd;
usecrate::tables::word as wd;
if self.string.len() == 0 {
return None;
}
Expand DownExpand Up@@ -414,7 +414,7 @@ impl<'a> DoubleEndedIterator for UWordBounds<'a> {
fn next_back(&mut self) -> Option<&'a str> {
use self::UWordBoundsState::*;
use self::FormatExtendType::*;
use tables::word as wd;
usecrate::tables::word as wd;
if self.string.len() == 0 {
return None;
}
Expand DownExpand Up@@ -666,7 +666,7 @@ impl<'a> UWordBounds<'a> {

#[inline]
fn get_next_cat(&self, idx: usize) -> Option<WordCat> {
use tables::word as wd;
usecrate::tables::word as wd;
let nidx = idx + self.string[idx..].chars().next().unwrap().len_utf8();
if nidx < self.string.len() {
let nch = self.string[nidx..].chars().next().unwrap();
Expand All@@ -678,7 +678,7 @@ impl<'a> UWordBounds<'a> {

#[inline]
fn get_prev_cat(&self, idx: usize) -> Option<WordCat> {
use tables::word as wd;
usecrate::tables::word as wd;
if idx > 0 {
let nch = self.string[..idx].chars().next_back().unwrap();
Some(wd::word_category(nch).2)
Expand All@@ -700,7 +700,7 @@ pub fn new_word_bound_indices<'b>(s: &'b str) -> UWordBoundIndices<'b> {

#[inline]
fn has_alphanumeric(s: &&str) -> bool {
use tables::util::is_alphanumeric;
usecrate::tables::util::is_alphanumeric;

s.chars().any(|c| is_alphanumeric(c))
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp