chore(language): Sort imports and migrate from deprecated types.

std:#️⃣:SipHasher is not std::collections::hash_map::DefaultHasher
(really!?).
Imports were unordered.
This commit is contained in:
Lewin Bormann
2017-01-31 19:27:50 +01:00
parent b140fe2611
commit d4ebbc47b2
4 changed files with 16 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
[package]
name = "yup-oauth2"
version = "1.0.2"
version = "1.0.3"
authors = ["Sebastian Thiel <byronimo@gmail.com>", "Lewin Bormann <lbo@spheniscida.de>"]
repository = "https://github.com/dermesser/yup-oauth2"
description = "An oauth2 implementation, providing the 'device', 'service account' and 'installed' authorization flows"

View File

@@ -1,20 +1,21 @@
use std::iter::IntoIterator;
use std::borrow::BorrowMut;
use std::hash::{SipHasher, Hash, Hasher};
use std::thread::sleep;
use std::cmp::min;
use std::error::Error;
use std::collections::hash_map::DefaultHasher;
use std::convert::From;
use std::error::Error;
use std::hash::{Hash, Hasher};
use std::iter::IntoIterator;
use std::thread::sleep;
use authenticator_delegate::{AuthenticatorDelegate, PollError, PollInformation};
use types::{RequestError, StringError, Token, FlowType, ApplicationSecret};
use device::{GOOGLE_DEVICE_CODE_URL, DeviceFlow};
use installed::{InstalledFlow, InstalledFlowReturnMethod};
use refresh::{RefreshResult, RefreshFlow};
use storage::TokenStorage;
use std::time::Duration;
use hyper;
use storage::TokenStorage;
use types::{RequestError, StringError, Token, FlowType, ApplicationSecret};
use hyper;
/// A generalized authenticator which will keep tokens valid and store them.
///
@@ -198,7 +199,7 @@ impl<D, S, C> GetToken for Authenticator<D, S, C>
.map(|s| s.as_ref())
.collect::<Vec<&str>>();
sv.sort();
let mut sh = SipHasher::new();
let mut sh = DefaultHasher::new();
&sv.hash(&mut sh);
let sv = sv;
(sh.finish(), sv)

View File

@@ -14,13 +14,13 @@
use std::borrow::BorrowMut;
use std::default::Default;
use std::error;
use std::io::{Read, Write};
use std::io::Read;
use std::result;
use std::str;
use authenticator::GetToken;
use types::{StringError, Token};
use storage::{hash_scopes, MemoryStorage, TokenStorage};
use types::{StringError, Token};
use hyper::header;
use url::form_urlencoded;

View File

@@ -6,12 +6,13 @@
extern crate serde_json;
use std::collections::HashMap;
use std::collections::hash_map::DefaultHasher;
use std::error::Error;
use std::fmt;
use std::fs;
use std::hash::{SipHasher, Hash, Hasher};
use std::io;
use std::hash::{Hash, Hasher};
use std::io::{Read, Write};
use std::io;
use types::Token;
@@ -43,7 +44,7 @@ pub fn hash_scopes<'a, I, T>(scopes: I) -> (u64, Vec<&'a str>)
.map(|s| s.as_ref())
.collect::<Vec<&str>>();
sv.sort();
let mut sh = SipHasher::new();
let mut sh = DefaultHasher::new();
&sv.hash(&mut sh);
let sv = sv;
(sh.finish(), sv)