Skip to content

Commit 7883b57

Browse files
committed
Run cargo fix
1 parent 3be7fa9 commit 7883b57

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

src/grapheme.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use core::cmp;
1212

13-
use tables::grapheme::GraphemeCat;
13+
use crate::tables::grapheme::GraphemeCat;
1414

1515
/// External iterator for grapheme clusters and byte offsets.
1616
#[derive(Clone)]
@@ -215,7 +215,7 @@ enum PairResult {
215215
}
216216

217217
fn check_pair(before: GraphemeCat, after: GraphemeCat) -> PairResult {
218-
use tables::grapheme::GraphemeCat::*;
218+
use crate::tables::grapheme::GraphemeCat::*;
219219
use self::PairResult::*;
220220
match (before, after) {
221221
(GC_CR, GC_LF) => NotBreak, // GB3
@@ -348,7 +348,7 @@ impl GraphemeCursor {
348348
/// assert_eq!(cursor.is_boundary(&flags[8..], 8), Ok(true));
349349
/// ```
350350
pub fn provide_context(&mut self, chunk: &str, chunk_start: usize) {
351-
use tables::grapheme as gr;
351+
use crate::tables::grapheme as gr;
352352
assert!(chunk_start + chunk.len() == self.pre_context_offset.unwrap());
353353
self.pre_context_offset = None;
354354
if self.is_extended && chunk_start + chunk.len() == self.offset {
@@ -394,7 +394,7 @@ impl GraphemeCursor {
394394
}
395395

396396
fn handle_regional(&mut self, chunk: &str, chunk_start: usize) {
397-
use tables::grapheme as gr;
397+
use crate::tables::grapheme as gr;
398398
let mut ris_count = self.ris_count.unwrap_or(0);
399399
for ch in chunk.chars().rev() {
400400
if gr::grapheme_category(ch) != gr::GC_Regional_Indicator {
@@ -414,7 +414,7 @@ impl GraphemeCursor {
414414
}
415415

416416
fn handle_emoji(&mut self, chunk: &str, chunk_start: usize) {
417-
use tables::grapheme as gr;
417+
use crate::tables::grapheme as gr;
418418
for ch in chunk.chars().rev() {
419419
match gr::grapheme_category(ch) {
420420
gr::GC_Extend => (),
@@ -460,7 +460,7 @@ impl GraphemeCursor {
460460
/// assert_eq!(cursor.is_boundary(flags, 0), Ok(false));
461461
/// ```
462462
pub fn is_boundary(&mut self, chunk: &str, chunk_start: usize) -> Result<bool, GraphemeIncomplete> {
463-
use tables::grapheme as gr;
463+
use crate::tables::grapheme as gr;
464464
if self.state == GraphemeState::Break {
465465
return Ok(true)
466466
}
@@ -550,7 +550,7 @@ impl GraphemeCursor {
550550
/// assert_eq!(cursor.next_boundary(&s[2..4], 2), Ok(None));
551551
/// ```
552552
pub fn next_boundary(&mut self, chunk: &str, chunk_start: usize) -> Result<Option<usize>, GraphemeIncomplete> {
553-
use tables::grapheme as gr;
553+
use crate::tables::grapheme as gr;
554554
if self.offset == self.len {
555555
return Ok(None);
556556
}
@@ -626,7 +626,7 @@ impl GraphemeCursor {
626626
/// assert_eq!(cursor.prev_boundary(&s[0..2], 0), Ok(None));
627627
/// ```
628628
pub fn prev_boundary(&mut self, chunk: &str, chunk_start: usize) -> Result<Option<usize>, GraphemeIncomplete> {
629-
use tables::grapheme as gr;
629+
use crate::tables::grapheme as gr;
630630
if self.offset == 0 {
631631
return Ok(None);
632632
}

src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ extern crate std;
6363
#[macro_use]
6464
extern crate quickcheck;
6565

66-
pub use grapheme::{Graphemes, GraphemeIndices};
67-
pub use grapheme::{GraphemeCursor, GraphemeIncomplete};
68-
pub use tables::UNICODE_VERSION;
69-
pub use word::{UWordBounds, UWordBoundIndices, UnicodeWords};
70-
pub use sentence::{USentenceBounds, USentenceBoundIndices, UnicodeSentences};
66+
pub use crate::grapheme::{Graphemes, GraphemeIndices};
67+
pub use crate::grapheme::{GraphemeCursor, GraphemeIncomplete};
68+
pub use crate::tables::UNICODE_VERSION;
69+
pub use crate::word::{UWordBounds, UWordBoundIndices, UnicodeWords};
70+
pub use crate::sentence::{USentenceBounds, USentenceBoundIndices, UnicodeSentences};
7171

7272
mod grapheme;
7373
mod tables;

src/sentence.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use core::iter::Filter;
1313

1414
// All of the logic for forward iteration over sentences
1515
mod fwd {
16-
use tables::sentence::SentenceCat;
16+
use crate::tables::sentence::SentenceCat;
1717
use core::cmp;
1818

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

113113
if parts[idx] == StatePart::ATerm {
114-
use tables::sentence as se;
114+
use crate::tables::sentence as se;
115115

116116
for next_char in ahead.chars() {
117117
//( ¬(OLetter | Upper | Lower | ParaSep | SATerm) )* Lower
@@ -176,7 +176,7 @@ mod fwd {
176176

177177
#[inline]
178178
fn next(&mut self) -> Option<usize> {
179-
use tables::sentence as se;
179+
use crate::tables::sentence as se;
180180

181181
for next_char in self.string[self.pos..].chars() {
182182
let position_before = self.pos;
@@ -313,7 +313,7 @@ pub fn new_sentence_bound_indices<'a>(source: &'a str) -> USentenceBoundIndices<
313313
#[inline]
314314
pub fn new_unicode_sentences<'b>(s: &'b str) -> UnicodeSentences<'b> {
315315
use super::UnicodeSegmentation;
316-
use tables::util::is_alphanumeric;
316+
use crate::tables::util::is_alphanumeric;
317317

318318
fn has_alphanumeric(s: &&str) -> bool { s.chars().any(|c| is_alphanumeric(c)) }
319319
let has_alphanumeric: fn(&&str) -> bool = has_alphanumeric; // coerce to fn pointer

src/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::prelude::v1::*;
1414

1515
#[test]
1616
fn test_graphemes() {
17-
use testdata::{TEST_SAME, TEST_DIFF};
17+
use crate::testdata::{TEST_SAME, TEST_DIFF};
1818

1919
pub const EXTRA_DIFF: &'static [(&'static str,
2020
&'static [&'static str],
@@ -88,7 +88,7 @@ fn test_graphemes() {
8888

8989
#[test]
9090
fn test_words() {
91-
use testdata::TEST_WORD;
91+
use crate::testdata::TEST_WORD;
9292

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

145145
#[test]
146146
fn test_sentences() {
147-
use testdata::TEST_SENTENCE;
147+
use crate::testdata::TEST_SENTENCE;
148148

149149
for &(s, w) in TEST_SENTENCE.iter() {
150150
macro_rules! assert_ {

src/word.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use core::cmp;
1212
use core::iter::Filter;
1313

14-
use tables::word::WordCat;
14+
use crate::tables::word::WordCat;
1515

1616
/// An iterator over the substrings of a string which, after splitting the string on
1717
/// [word boundaries](http://www.unicode.org/reports/tr29/#Word_Boundaries),
@@ -135,7 +135,7 @@ impl<'a> Iterator for UWordBounds<'a> {
135135
fn next(&mut self) -> Option<&'a str> {
136136
use self::UWordBoundsState::*;
137137
use self::FormatExtendType::*;
138-
use tables::word as wd;
138+
use crate::tables::word as wd;
139139
if self.string.len() == 0 {
140140
return None;
141141
}
@@ -364,7 +364,7 @@ impl<'a> DoubleEndedIterator for UWordBounds<'a> {
364364
fn next_back(&mut self) -> Option<&'a str> {
365365
use self::UWordBoundsState::*;
366366
use self::FormatExtendType::*;
367-
use tables::word as wd;
367+
use crate::tables::word as wd;
368368
if self.string.len() == 0 {
369369
return None;
370370
}
@@ -605,7 +605,7 @@ impl<'a> UWordBounds<'a> {
605605

606606
#[inline]
607607
fn get_next_cat(&self, idx: usize) -> Option<WordCat> {
608-
use tables::word as wd;
608+
use crate::tables::word as wd;
609609
let nidx = idx + self.string[idx..].chars().next().unwrap().len_utf8();
610610
if nidx < self.string.len() {
611611
let nch = self.string[nidx..].chars().next().unwrap();
@@ -617,7 +617,7 @@ impl<'a> UWordBounds<'a> {
617617

618618
#[inline]
619619
fn get_prev_cat(&self, idx: usize) -> Option<WordCat> {
620-
use tables::word as wd;
620+
use crate::tables::word as wd;
621621
if idx > 0 {
622622
let nch = self.string[..idx].chars().next_back().unwrap();
623623
Some(wd::word_category(nch))
@@ -640,7 +640,7 @@ pub fn new_word_bound_indices<'b>(s: &'b str) -> UWordBoundIndices<'b> {
640640
#[inline]
641641
pub fn new_unicode_words<'b>(s: &'b str) -> UnicodeWords<'b> {
642642
use super::UnicodeSegmentation;
643-
use tables::util::is_alphanumeric;
643+
use crate::tables::util::is_alphanumeric;
644644

645645
fn has_alphanumeric(s: &&str) -> bool { s.chars().any(|c| is_alphanumeric(c)) }
646646
let has_alphanumeric: fn(&&str) -> bool = has_alphanumeric; // coerce to fn pointer

0 commit comments

Comments
 (0)