summaryrefslogtreecommitdiff
path: root/src/regex_set.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <ecoal95@gmail.com>2016-11-01 12:56:14 +0100
committerEmilio Cobos Álvarez <ecoal95@gmail.com>2016-11-01 17:07:37 +0100
commitf226fef4c8e0c97d674a2426eb8bd7f1ad0141e5 (patch)
treeb3b310871ca50344dbbc2fbb08c8a328b8636e2b /src/regex_set.rs
parent163848e82c692db951ed301b0a9e3fee9d45338c (diff)
Run `cargo fmt`.
Diffstat (limited to 'src/regex_set.rs')
-rw-r--r--src/regex_set.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/regex_set.rs b/src/regex_set.rs
index ff899d78..93130590 100644
--- a/src/regex_set.rs
+++ b/src/regex_set.rs
@@ -1,7 +1,7 @@
//! A type that represents the union of a set of regular expressions.
-use std::borrow::Borrow;
use regex::Regex;
+use std::borrow::Borrow;
// Yeah, I'm aware this is sorta crappy, should be cheaper to compile a regex
// ORing all the patterns, I guess...
@@ -9,7 +9,7 @@ use regex::Regex;
/// A dynamic set of regular expressions.
#[derive(Debug)]
pub struct RegexSet {
- items: Vec<Regex>
+ items: Vec<Regex>,
}
impl RegexSet {
@@ -20,7 +20,7 @@ impl RegexSet {
/// Extend this set with every regex in the iterator.
pub fn extend<I>(&mut self, iter: I)
- where I: IntoIterator<Item=String>
+ where I: IntoIterator<Item = String>,
{
for s in iter.into_iter() {
self.insert(&s)
@@ -29,7 +29,7 @@ impl RegexSet {
/// Insert a new regex into this set.
pub fn insert<S>(&mut self, string: &S)
- where S: Borrow<str>
+ where S: Borrow<str>,
{
let s = string.borrow();
match Regex::new(&format!("^{}$", s)) {
@@ -44,7 +44,7 @@ impl RegexSet {
/// Does the given `string` match any of the regexes in this set?
pub fn matches<S>(&self, string: &S) -> bool
- where S: Borrow<str>
+ where S: Borrow<str>,
{
let s = string.borrow();
for r in &self.items {