]> git.lizzy.rs Git - rust.git/commitdiff
Remove the unused ascii_only field in CharEqSearcher
authorManish Goregaokar <manishsmail@gmail.com>
Wed, 13 Dec 2017 19:11:48 +0000 (13:11 -0600)
committerManish Goregaokar <manishsmail@gmail.com>
Wed, 13 Dec 2017 19:11:48 +0000 (13:11 -0600)
src/libcore/str/pattern.rs

index edb7bed4520fb0e1df9f5635cc96a6eebc1078ff..3200cfc498236e120a1ff1d206ead816e78040fc 100644 (file)
@@ -241,23 +241,16 @@ pub trait DoubleEndedSearcher<'a>: ReverseSearcher<'a> {}
 #[doc(hidden)]
 trait CharEq {
     fn matches(&mut self, c: char) -> bool;
-    fn only_ascii(&self) -> bool;
 }
 
 impl CharEq for char {
     #[inline]
     fn matches(&mut self, c: char) -> bool { *self == c }
-
-    #[inline]
-    fn only_ascii(&self) -> bool { (*self as u32) < 128 }
 }
 
 impl<F> CharEq for F where F: FnMut(char) -> bool {
     #[inline]
     fn matches(&mut self, c: char) -> bool { (*self)(c) }
-
-    #[inline]
-    fn only_ascii(&self) -> bool { false }
 }
 
 impl<'a> CharEq for &'a [char] {
@@ -265,11 +258,6 @@ impl<'a> CharEq for &'a [char] {
     fn matches(&mut self, c: char) -> bool {
         self.iter().any(|&m| { let mut m = m; m.matches(c) })
     }
-
-    #[inline]
-    fn only_ascii(&self) -> bool {
-        self.iter().all(|m| m.only_ascii())
-    }
 }
 
 struct CharEqPattern<C: CharEq>(C);
@@ -279,8 +267,6 @@ struct CharEqSearcher<'a, C: CharEq> {
     char_eq: C,
     haystack: &'a str,
     char_indices: super::CharIndices<'a>,
-    #[allow(dead_code)]
-    ascii_only: bool,
 }
 
 impl<'a, C: CharEq> Pattern<'a> for CharEqPattern<C> {
@@ -289,7 +275,6 @@ impl<'a, C: CharEq> Pattern<'a> for CharEqPattern<C> {
     #[inline]
     fn into_searcher(self, haystack: &'a str) -> CharEqSearcher<'a, C> {
         CharEqSearcher {
-            ascii_only: self.0.only_ascii(),
             haystack,
             char_eq: self.0,
             char_indices: haystack.char_indices(),
@@ -499,7 +484,6 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_struct("CharPredicateSearcher")
             .field("haystack", &self.0.haystack)
             .field("char_indices", &self.0.char_indices)
-            .field("ascii_only", &self.0.ascii_only)
             .finish()
     }
 }