aboutsummaryrefslogtreecommitdiff
path: root/src/nfa.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/nfa.rs')
-rw-r--r--src/nfa.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nfa.rs b/src/nfa.rs
index 3fc890c..4757b83 100644
--- a/src/nfa.rs
+++ b/src/nfa.rs
@@ -153,7 +153,7 @@ impl NFA {
result
}
- pub fn matches(&self, input: String) -> bool {
+ pub fn matches(&self, input: &str) -> bool {
let chars = input.chars();
self.matches_helper(self.states.get(&self.initial_state).unwrap(), chars)
}
@@ -165,12 +165,12 @@ mod tests {
use crate::regex::Regex;
fn test(regex: &str, input: &str) -> bool {
- let token = Regex::new(String::from(regex));
+ let token = Regex::new(regex);
let mut nfa = NFA::new();
nfa.regex_to_nfa(token);
let mut x: Vec<(&usize, &State)> = nfa.states.iter().map(|(k, v)| (k, v)).collect();
x.sort();
- nfa.matches(String::from(input))
+ nfa.matches(input)
}
#[test]