From aa030e8987760720f3d616cb0dad18c531bc7a45 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 27 Feb 2015 15:06:50 +0100 Subject: [PATCH] fix(common): AuthenticationType implements Str Instead of an arbitrary `url()` method with the signature of `to_slice()` --- src/common.rs | 4 ++-- src/device.rs | 2 +- src/refresh.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common.rs b/src/common.rs index e43a9a6..526fb88 100644 --- a/src/common.rs +++ b/src/common.rs @@ -23,9 +23,9 @@ pub enum AuthenticationType { Device, } -impl AuthenticationType { +impl Str for AuthenticationType { /// Converts itself into a URL string - pub fn url(&self) -> &'static str { + fn as_slice(&self) -> &'static str { match *self { AuthenticationType::Device => "https://accounts.google.com/o/oauth2/device/code", } diff --git a/src/device.rs b/src/device.rs index cfc6dc0..cf400f4 100644 --- a/src/device.rs +++ b/src/device.rs @@ -150,7 +150,7 @@ impl DeviceFlow .collect::() .as_slice())].iter().cloned()); - match self.client.post(AuthenticationType::Device.url()) + match self.client.post(AuthenticationType::Device.as_slice()) .header(ContentType("application/x-www-form-urlencoded".parse().unwrap())) .body(req.as_slice()) .send() { diff --git a/src/refresh.rs b/src/refresh.rs index 4838ffe..90250fd 100644 --- a/src/refresh.rs +++ b/src/refresh.rs @@ -68,7 +68,7 @@ impl RefreshFlow .iter().cloned()); let json_str = - match self.client.post(auth_type.url()) + match self.client.post(auth_type.as_slice()) .header(ContentType("application/x-www-form-urlencoded".parse().unwrap())) .body(req.as_slice()) .send() {