diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-12-14 22:46:59 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2014-12-19 10:43:24 -0500 |
| commit | f2ef2cda526ba601cf5091f65cb12962a0ae0956 (patch) | |
| tree | 020d5860f63056176f6749edcb999e9a1559ddfc /src | |
| parent | fd4a5d9ef12a87cad61f2fa5dd0a011df263a2d0 (diff) | |
| download | rust-f2ef2cda526ba601cf5091f65cb12962a0ae0956.tar.gz rust-f2ef2cda526ba601cf5091f65cb12962a0ae0956.zip | |
libregex: use `#[deriving(Copy)]`
Diffstat (limited to 'src')
| -rw-r--r-- | src/libregex/parse.rs | 4 | ||||
| -rw-r--r-- | src/libregex/re.rs | 3 | ||||
| -rw-r--r-- | src/libregex/vm.rs | 6 |
3 files changed, 4 insertions, 9 deletions
diff --git a/src/libregex/parse.rs b/src/libregex/parse.rs index 60cf45aeddc..78558a32266 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 53181bfbb7e..151587e423a 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<Option<uint>> } -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 15a678d2e74..990d5a159f6 100644 --- a/src/libregex/vm.rs +++ b/src/libregex/vm.rs @@ -50,6 +50,7 @@ use unicode::regex::PERLW; pub type CaptureLocs = Vec<Option<uint>>; /// 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 { |
