libregex: use #[deriving(Copy)]

This commit is contained in:
Jorge Aparicio 2014-12-14 22:46:59 -05:00
parent fd4a5d9ef1
commit f2ef2cda52
3 changed files with 4 additions and 9 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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 {