diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-12-14 22:37:29 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2014-12-19 10:43:24 -0500 |
| commit | c407785ac0b535dc98e9bf2d9c595111cfff31cc (patch) | |
| tree | 3cf0801435a6ad7bc52b1e7b56200fa80e2313f6 | |
| parent | 4c62c76ef99aab3a752c4ebd74b63819cabee98f (diff) | |
| download | rust-c407785ac0b535dc98e9bf2d9c595111cfff31cc.tar.gz rust-c407785ac0b535dc98e9bf2d9c595111cfff31cc.zip | |
libgetopts: use `#[deriving(Copy)]`
| -rw-r--r-- | src/libgetopts/lib.rs | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 38729eece5a..b45d0c9b01e 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -118,7 +118,7 @@ pub enum Name { } /// Describes whether an option has an argument. -#[deriving(Clone, PartialEq, Eq)] +#[deriving(Clone, Copy, PartialEq, Eq)] pub enum HasArg { /// The option requires an argument. Yes, @@ -128,10 +128,8 @@ pub enum HasArg { Maybe, } -impl Copy for HasArg {} - /// Describes how often an option may occur. -#[deriving(Clone, PartialEq, Eq)] +#[deriving(Clone, Copy, PartialEq, Eq)] pub enum Occur { /// The option occurs once. Req, @@ -141,8 +139,6 @@ pub enum Occur { Multi, } -impl Copy for Occur {} - /// A description of a possible option. #[deriving(Clone, PartialEq, Eq)] pub struct Opt { @@ -211,7 +207,7 @@ pub enum Fail { } /// The type of failure that occurred. -#[deriving(PartialEq, Eq)] +#[deriving(Copy, PartialEq, Eq)] #[allow(missing_docs)] pub enum FailType { ArgumentMissing_, @@ -221,8 +217,6 @@ pub enum FailType { UnexpectedArgument_, } -impl Copy for FailType {} - /// The result of parsing a command line with a set of options. pub type Result = result::Result<Matches, Fail>; @@ -839,22 +833,22 @@ pub fn short_usage(program_name: &str, opts: &[OptGroup]) -> String { line } +#[deriving(Copy)] enum SplitWithinState { A, // leading whitespace, initial state B, // words C, // internal and trailing whitespace } -impl Copy for SplitWithinState {} +#[deriving(Copy)] enum Whitespace { Ws, // current char is whitespace Cr // current char is not whitespace } -impl Copy for Whitespace {} +#[deriving(Copy)] enum LengthLimit { UnderLim, // current char makes current substring still fit in limit OverLim // current char makes current substring no longer fit in limit } -impl Copy for LengthLimit {} /// Splits a string into substrings with possibly internal whitespace, |
