Derive Clone, Copy, PartialEq, Eq wherever possible

This commit is contained in:
Curtis McEnroe 2015-12-30 02:57:02 -05:00
parent 65eb87e1d4
commit 10775d0823
7 changed files with 12 additions and 11 deletions

View File

@ -21,7 +21,7 @@ pub trait FromResponse: Sized {
}
/// Response parse errors.
#[derive(Debug, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ParseError {
/// Expected response to be of type.
ExpectedType(&'static str),
@ -56,7 +56,7 @@ impl Error for ParseError {
}
/// JSON helper for response parsing.
#[derive(Debug)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct JsonHelper<'a>(pub &'a Json);
impl<'a> JsonHelper<'a> {
@ -69,7 +69,7 @@ impl<'a> JsonHelper<'a> {
}
/// JSON object helper for response parsing.
#[derive(Debug)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct JsonObjectHelper<'a>(pub &'a json::Object);
impl<'a> JsonObjectHelper<'a> {

View File

@ -10,7 +10,7 @@ use client::response::{FromResponse, ParseError, JsonHelper};
/// OAuth 2.0 error codes.
///
/// See [RFC 6749, section 5.2](http://tools.ietf.org/html/rfc6749#section-5.2).
#[derive(Debug, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum OAuth2ErrorCode {
/// The request is missing a required parameter, includes an unsupported parameter value (other
/// than grant type), repeats a parameter, includes multiple credentials, utilizes more than
@ -57,7 +57,7 @@ impl<'a> From<&'a str> for OAuth2ErrorCode {
/// OAuth 2.0 error.
///
/// See [RFC 6749, section 5.2](http://tools.ietf.org/html/rfc6749#section-5.2).
#[derive(Debug, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct OAuth2Error {
/// Error code.
pub code: OAuth2ErrorCode,

View File

@ -126,6 +126,7 @@
#![warn(
missing_docs,
missing_debug_implementations,
missing_copy_implementations,
trivial_casts,
trivial_numeric_casts,
unused_extern_crates,

View File

@ -25,7 +25,7 @@ pub trait Provider {
///
/// See [Using OAuth 2.0 to Access Google
/// APIs](https://developers.google.com/identity/protocols/OAuth2).
#[derive(Debug)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Google;
impl Provider for Google {
type Lifetime = Expiring;
@ -37,7 +37,7 @@ impl Provider for Google {
/// GitHub OAuth 2.0 provider.
///
/// See [OAuth, GitHub Developer Guide](https://developer.github.com/v3/oauth/).
#[derive(Debug)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct GitHub;
impl Provider for GitHub {
type Lifetime = Static;
@ -49,7 +49,7 @@ impl Provider for GitHub {
/// Imgur OAuth 2.0 provider.
///
/// See [OAuth 2.0, Imgur](https://api.imgur.com/oauth2).
#[derive(Debug)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Imgur;
impl Provider for Imgur {
type Lifetime = Expiring;

View File

@ -7,7 +7,7 @@ use client::response::{FromResponse, ParseError, JsonHelper};
/// The bearer token type.
///
/// See [RFC 6750](http://tools.ietf.org/html/rfc6750).
#[derive(Debug, PartialEq, Eq, RustcEncodable, RustcDecodable)]
#[derive(Debug, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
pub struct Bearer<L: Lifetime> {
access_token: String,
scope: Option<String>,

View File

@ -6,7 +6,7 @@ use super::Lifetime;
use client::response::{FromResponse, ParseError, JsonHelper};
/// An expiring token.
#[derive(Debug, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Expiring {
refresh_token: String,
expires: DateTime<UTC>,

View File

@ -4,7 +4,7 @@ use super::Lifetime;
use client::response::{FromResponse, ParseError, JsonHelper};
/// A static, non-expiring token.
#[derive(Debug, PartialEq, Eq, RustcEncodable, RustcDecodable)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable)]
pub struct Static;
impl Lifetime for Static {