diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-09-24 09:40:50 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-09-24 09:40:50 -0700 |
| commit | 81f0bf76672e2f4d30470920e62dc3cfe70bec6c (patch) | |
| tree | 467450860ac471c1f8eebd0e58251d84a3c1c23d | |
| parent | 8fe79bdfdacb2f5914971bd1a0b63b9577afbf6a (diff) | |
| download | rust-81f0bf76672e2f4d30470920e62dc3cfe70bec6c.tar.gz rust-81f0bf76672e2f4d30470920e62dc3cfe70bec6c.zip | |
std: Switch string::ParseError to an empty enum
It can never be instantiated, so signify this by having it actually be an empty `enum`. cc #27734
| -rw-r--r-- | src/libcollections/string.rs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index bb65d7469ab..eb6aa4eec30 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -1030,8 +1030,8 @@ impl ops::DerefMut for String { #[unstable(feature = "str_parse_error", reason = "may want to be replaced with \ Void if it ever exists", issue = "27734")] -#[derive(Copy, Clone, Debug, Eq, PartialEq)] -pub struct ParseError(()); +#[derive(Copy)] +pub enum ParseError {} #[stable(feature = "rust1", since = "1.0.0")] impl FromStr for String { @@ -1042,6 +1042,26 @@ impl FromStr for String { } } +impl Clone for ParseError { + fn clone(&self) -> ParseError { + match *self {} + } +} + +impl fmt::Debug for ParseError { + fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result { + match *self {} + } +} + +impl PartialEq for ParseError { + fn eq(&self, _: &ParseError) -> bool { + match *self {} + } +} + +impl Eq for ParseError {} + /// A generic trait for converting a value to a string #[stable(feature = "rust1", since = "1.0.0")] pub trait ToString { |
