summaryrefslogtreecommitdiff
path: root/src/regex_set.rs
diff options
context:
space:
mode:
authorAnna Liao <aliao22@gmail.com>2017-08-20 16:26:59 -0600
committerNick Fitzgerald <fitzgen@gmail.com>2017-08-21 13:34:58 -0700
commiteeec4bd2a197bb0ed71419f0700a93d418f6899a (patch)
tree5d62c892412d068e7e678674fb41528f8d423ce5 /src/regex_set.rs
parent79447a288fe4ae3c9432e61d60818b5a9b526b15 (diff)
Rename `TypeKind::Named` to `TypeKind::TypeParam`
Also renames a bunch of other things referring to named types to refer to type parameters. Fixes #915
Diffstat (limited to 'src/regex_set.rs')
-rw-r--r--src/regex_set.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/regex_set.rs b/src/regex_set.rs
index a93e7a13..a6f51336 100644
--- a/src/regex_set.rs
+++ b/src/regex_set.rs
@@ -20,8 +20,9 @@ impl RegexSet {
/// Extend this set with every regex in the iterator.
pub fn extend<I, S>(&mut self, iter: I)
- where I: IntoIterator<Item = S>,
- S: AsRef<str>,
+ where
+ I: IntoIterator<Item = S>,
+ S: AsRef<str>,
{
for s in iter.into_iter() {
self.insert(s)
@@ -30,12 +31,13 @@ impl RegexSet {
/// Insert a new regex into this set.
pub fn insert<S>(&mut self, string: S)
- where S: AsRef<str>,
+ where
+ S: AsRef<str>,
{
self.items.push(format!("^{}$", string.as_ref()));
self.set = None;
}
-
+
/// Returns slice of String from its field 'items'
pub fn get_items(&self) -> &[String] {
&self.items[..]
@@ -61,10 +63,13 @@ impl RegexSet {
/// Does the given `string` match any of the regexes in this set?
pub fn matches<S>(&self, string: S) -> bool
- where S: AsRef<str>,
+ where
+ S: AsRef<str>,
{
let s = string.as_ref();
- self.set.as_ref().map(|set| set.is_match(s)).unwrap_or(false)
+ self.set.as_ref().map(|set| set.is_match(s)).unwrap_or(
+ false,
+ )
}
}