diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-06 15:22:24 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-06 15:22:24 -0800 |
| commit | 5c3ddcb15dc8b40fa780a38fd7494b9b5b991d09 (patch) | |
| tree | 9ad6d0c242e45a785dae4b22f1e4ddd9d4f9c55a /src/libgetopts/lib.rs | |
| parent | 5f27b500800fc2720c5caa4a0cd5dcc46c0b911f (diff) | |
| parent | 44440e5c18a1dbcc9685866ffffe00c508929079 (diff) | |
| download | rust-5c3ddcb15dc8b40fa780a38fd7494b9b5b991d09.tar.gz rust-5c3ddcb15dc8b40fa780a38fd7494b9b5b991d09.zip | |
rollup merge of #20481: seanmonstar/fmt-show-string
Conflicts: src/compiletest/runtest.rs src/libcore/fmt/mod.rs src/libfmt_macros/lib.rs src/libregex/parse.rs src/librustc/middle/cfg/construct.rs src/librustc/middle/dataflow.rs src/librustc/middle/infer/higher_ranked/mod.rs src/librustc/middle/ty.rs src/librustc_back/archive.rs src/librustc_borrowck/borrowck/fragments.rs src/librustc_borrowck/borrowck/gather_loans/mod.rs src/librustc_resolve/lib.rs src/librustc_trans/back/link.rs src/librustc_trans/save/mod.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/callee.rs src/librustc_trans/trans/common.rs src/librustc_trans/trans/consts.rs src/librustc_trans/trans/controlflow.rs src/librustc_trans/trans/debuginfo.rs src/librustc_trans/trans/expr.rs src/librustc_trans/trans/monomorphize.rs src/librustc_typeck/astconv.rs src/librustc_typeck/check/method/mod.rs src/librustc_typeck/check/mod.rs src/librustc_typeck/check/regionck.rs src/librustc_typeck/collect.rs src/libsyntax/ext/format.rs src/libsyntax/ext/source_util.rs src/libsyntax/ext/tt/transcribe.rs src/libsyntax/parse/mod.rs src/libsyntax/parse/token.rs src/test/run-pass/issue-8898.rs
Diffstat (limited to 'src/libgetopts/lib.rs')
| -rw-r--r-- | src/libgetopts/lib.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index dd9e5e5a038..64d4de7cc8a 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -105,7 +105,7 @@ use std::iter::repeat; use std::result; /// Name of an option. Either a string or a single char. -#[derive(Clone, PartialEq, Eq)] +#[derive(Clone, PartialEq, Eq, Show)] pub enum Name { /// A string representing the long name of an option. /// For example: "help" @@ -116,7 +116,7 @@ pub enum Name { } /// Describes whether an option has an argument. -#[derive(Clone, Copy, PartialEq, Eq)] +#[derive(Clone, Copy, PartialEq, Eq, Show)] pub enum HasArg { /// The option requires an argument. Yes, @@ -127,7 +127,7 @@ pub enum HasArg { } /// Describes how often an option may occur. -#[derive(Clone, Copy, PartialEq, Eq)] +#[derive(Clone, Copy, PartialEq, Eq, Show)] pub enum Occur { /// The option occurs once. Req, @@ -138,7 +138,7 @@ pub enum Occur { } /// A description of a possible option. -#[derive(Clone, PartialEq, Eq)] +#[derive(Clone, PartialEq, Eq, Show)] pub struct Opt { /// Name of the option pub name: Name, @@ -152,7 +152,7 @@ pub struct Opt { /// One group of options, e.g., both `-h` and `--help`, along with /// their shared description and properties. -#[derive(Clone, PartialEq, Eq)] +#[derive(Clone, PartialEq, Eq, Show)] pub struct OptGroup { /// Short name of the option, e.g. `h` for a `-h` option pub short_name: String, @@ -169,7 +169,7 @@ pub struct OptGroup { } /// Describes whether an option is given at all or has a value. -#[derive(Clone, PartialEq, Eq)] +#[derive(Clone, PartialEq, Eq, Show)] enum Optval { Val(String), Given, @@ -177,7 +177,7 @@ enum Optval { /// The result of checking command line arguments. Contains a vector /// of matches and a vector of free strings. -#[derive(Clone, PartialEq, Eq)] +#[derive(Clone, PartialEq, Eq, Show)] pub struct Matches { /// Options that matched opts: Vec<Opt>, @@ -190,7 +190,7 @@ pub struct Matches { /// The type returned when the command line does not conform to the /// expected format. Use the `Show` implementation to output detailed /// information. -#[derive(Clone, PartialEq, Eq)] +#[derive(Clone, PartialEq, Eq, Show)] pub enum Fail { /// The option requires an argument but none was passed. ArgumentMissing(String), @@ -205,7 +205,7 @@ pub enum Fail { } /// The type of failure that occurred. -#[derive(Copy, PartialEq, Eq)] +#[derive(Copy, PartialEq, Eq, Show)] #[allow(missing_docs)] pub enum FailType { ArgumentMissing_, @@ -536,13 +536,13 @@ pub fn opt(short_name: &str, impl Fail { /// Convert a `Fail` enum into an error string. - #[deprecated="use `Show` (`{}` format specifier)"] + #[deprecated="use `fmt::String` (`{}` format specifier)"] pub fn to_err_msg(self) -> String { self.to_string() } } -impl fmt::Show for Fail { +impl fmt::String for Fail { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { ArgumentMissing(ref nm) => { |
