diff --git a/src/libregex/parse.rs b/src/libregex/parse.rs index 60cf45aeddc1..78558a322665 100644 --- a/src/libregex/parse.rs +++ b/src/libregex/parse.rs @@ -77,14 +77,12 @@ pub enum Repeater { OneMore, } -#[deriving(Show, Clone)] +#[deriving(Copy, Show, Clone)] pub enum Greed { Greedy, Ungreedy, } -impl Copy for Greed {} - impl Greed { pub fn is_greedy(&self) -> bool { match *self { diff --git a/src/libregex/re.rs b/src/libregex/re.rs index 53181bfbb7e3..151587e423ab 100644 --- a/src/libregex/re.rs +++ b/src/libregex/re.rs @@ -126,6 +126,7 @@ pub struct ExDynamic { } #[doc(hidden)] +#[deriving(Copy)] pub struct ExNative { #[doc(hidden)] pub original: &'static str, @@ -135,8 +136,6 @@ pub struct ExNative { pub prog: fn(MatchKind, &str, uint, uint) -> Vec> } -impl Copy for ExNative {} - impl Clone for ExNative { fn clone(&self) -> ExNative { *self diff --git a/src/libregex/vm.rs b/src/libregex/vm.rs index 15a678d2e745..990d5a159f60 100644 --- a/src/libregex/vm.rs +++ b/src/libregex/vm.rs @@ -50,6 +50,7 @@ use unicode::regex::PERLW; pub type CaptureLocs = Vec>; /// Indicates the type of match to be performed by the VM. +#[deriving(Copy)] pub enum MatchKind { /// Only checks if a match exists or not. Does not return location. Exists, @@ -60,8 +61,6 @@ pub enum MatchKind { Submatches, } -impl Copy for MatchKind {} - /// Runs an NFA simulation on the compiled expression given on the search text /// `input`. The search begins at byte index `start` and ends at byte index /// `end`. (The range is specified here so that zero-width assertions will work @@ -96,6 +95,7 @@ struct Nfa<'r, 't> { /// Indicates the next action to take after a single non-empty instruction /// is processed. +#[deriving(Copy)] pub enum StepState { /// This is returned if and only if a Match instruction is reached and /// we only care about the existence of a match. It instructs the VM to @@ -109,8 +109,6 @@ pub enum StepState { StepContinue, } -impl Copy for StepState {} - impl<'r, 't> Nfa<'r, 't> { fn run(&mut self) -> CaptureLocs { let ncaps = match self.which {