summaryrefslogtreecommitdiffstats
path: root/src/registration.rs
diff options
context:
space:
mode:
authorPaul Woolcock <paul@woolcock.us>2018-08-23 09:22:14 -0400
committerPaul Woolcock <paul@woolcock.us>2018-08-23 10:35:26 -0400
commit8636e690c30d4059a25fb4e6b6e0f0482bd2ee64 (patch)
treec67f448be3b43b379da7563afd791dc78963bd25 /src/registration.rs
parentd617d74fa48ca5bfdf548755e9a5e2754a18b251 (diff)
rustfmt pass
Diffstat (limited to 'src/registration.rs')
-rw-r--r--src/registration.rs23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/registration.rs b/src/registration.rs
index df2ef20..060bc68 100644
--- a/src/registration.rs
+++ b/src/registration.rs
@@ -1,8 +1,12 @@
use reqwest::Client;
use try_from::TryInto;
-use {Data, Error, Mastodon, MastodonBuilder, Result};
use apps::{App, Scopes};
+use Data;
+use Error;
+use Mastodon;
+use MastodonBuilder;
+use Result;
/// Handles registering your mastodon app to your instance. It is recommended
/// you cache your data struct to avoid registering on every run.
@@ -47,8 +51,7 @@ impl Registration {
/// ```no_run
/// # extern crate elefren;
/// # fn main () -> elefren::Result<()> {
- /// use elefren::prelude::*;
- /// use elefren::apps::prelude::*;
+ /// use elefren::{apps::prelude::*, prelude::*};
///
/// let mut builder = App::builder();
/// builder.client_name("elefren_test");
@@ -67,15 +70,12 @@ impl Registration {
/// # }
/// ```
pub fn register<I: TryInto<App>>(self, app: I) -> Result<Registered>
- where Error: From<<I as TryInto<App>>::Err>
+ where
+ Error: From<<I as TryInto<App>>::Err>,
{
let app = app.try_into()?;
let url = format!("{}/api/v1/apps", self.base);
- let oauth: OAuth = self.client
- .post(&url)
- .form(&app)
- .send()?
- .json()?;
+ let oauth: OAuth = self.client.post(&url).form(&app).send()?.json()?;
Ok(Registered {
base: self.base,
@@ -94,10 +94,7 @@ impl Registered {
pub fn authorize_url(&self) -> Result<String> {
let url = format!(
"{}/oauth/authorize?client_id={}&redirect_uri={}&scope={}&response_type=code",
- self.base,
- self.client_id,
- self.redirect,
- self.scopes,
+ self.base, self.client_id, self.redirect, self.scopes,
);
Ok(url)