Skip to content

Commit 852fb38

Browse files
author
David Ramos
committed
Run rustfmt
1 parent 684483b commit 852fb38

File tree

1 file changed

+19
-25
lines changed

1 file changed

+19
-25
lines changed

examples/wunderlist.rs

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,22 @@
1717
extern crate base64;
1818
extern crate oauth2;
1919
extern crate rand;
20-
extern crate url;
2120
extern crate serde;
21+
extern crate url;
2222

23+
use oauth2::basic::{BasicErrorResponse, BasicTokenType};
2324
use oauth2::TokenType;
24-
use oauth2::basic::{ BasicErrorResponse, BasicTokenType };
2525
// Alternatively, this can be `oauth2::curl::http_client` or a custom client.
26-
use oauth2::reqwest::http_client;
2726
use oauth2::helpers;
27+
use oauth2::reqwest::http_client;
2828
use oauth2::{
29-
AccessToken,
30-
AuthorizationCode,
31-
AuthUrl,
32-
Client,
33-
ClientId,
34-
ClientSecret,
35-
CsrfToken,
36-
EmptyExtraTokenFields,
37-
ExtraTokenFields,
38-
RedirectUrl,
39-
RefreshToken,
40-
Scope,
41-
TokenResponse,
29+
AccessToken, AuthUrl, AuthorizationCode, Client, ClientId, ClientSecret, CsrfToken,
30+
EmptyExtraTokenFields, ExtraTokenFields, RedirectUrl, RefreshToken, Scope, TokenResponse,
4231
TokenUrl,
4332
};
4433

34+
use serde::{Deserialize, Serialize};
4535
use std::time::Duration;
46-
use serde::{Serialize, Deserialize};
4736

4837
use std::env;
4938
use std::io::{BufRead, BufReader, Write};
@@ -53,7 +42,7 @@ use url::Url;
5342
type SpecialTokenResponse = NonStandardTokenResponse<EmptyExtraTokenFields>;
5443
type SpecialClient = Client<BasicErrorResponse, SpecialTokenResponse, BasicTokenType>;
5544

56-
fn default_token_type() -> Option<BasicTokenType>{
45+
fn default_token_type() -> Option<BasicTokenType> {
5746
Some(BasicTokenType::Bearer)
5847
}
5948

@@ -146,7 +135,7 @@ fn main() {
146135
.expect("Missing the WUNDERLIST_CLIENT_ID environment variable.");
147136

148137
let client_secret_str = env::var("WUNDERLIST_CLIENT_SECRET")
149-
.expect("Missing the WUNDERLIST_CLIENT_SECRET environment variable.");
138+
.expect("Missing the WUNDERLIST_CLIENT_SECRET environment variable.");
150139

151140
let wunder_client_id = ClientId::new(client_id_str.clone());
152141
let wunderlist_client_secret = ClientSecret::new(client_secret_str.clone());
@@ -173,9 +162,7 @@ fn main() {
173162
));
174163

175164
// Generate the authorization URL to which we'll redirect the user.
176-
let (authorize_url, csrf_state) = client
177-
.authorize_url(CsrfToken::new_random)
178-
.url();
165+
let (authorize_url, csrf_state) = client.authorize_url(CsrfToken::new_random).url();
179166

180167
println!(
181168
"Open this URL in your browser:\n{}\n",
@@ -228,20 +215,27 @@ fn main() {
228215
);
229216
stream.write_all(response.as_bytes()).unwrap();
230217

231-
println!("Wunderlist returned the following code:\n{}\n", code.secret());
218+
println!(
219+
"Wunderlist returned the following code:\n{}\n",
220+
code.secret()
221+
);
232222
println!(
233223
"Wunderlist returned the following state:\n{} (expected `{}`)\n",
234224
state.secret(),
235225
csrf_state.secret()
236226
);
237227

238228
// Exchange the code with a token.
239-
let token_res = client.exchange_code(code)
229+
let token_res = client
230+
.exchange_code(code)
240231
.add_extra_param("client_id", client_id_str)
241232
.add_extra_param("client_secret", client_secret_str)
242233
.request(http_client);
243234

244-
println!("Wunderlist returned the following token:\n{:?}\n", token_res);
235+
println!(
236+
"Wunderlist returned the following token:\n{:?}\n",
237+
token_res
238+
);
245239

246240
break;
247241
}

0 commit comments

Comments
 (0)