try! -> ?

This commit is contained in:
Steven Fackler
2017-05-22 21:55:51 -07:00
parent c9d4aba9a9
commit f892c4b57b
5 changed files with 144 additions and 140 deletions

View File

@@ -76,7 +76,7 @@ enum State {
/// should be sent to the backend in a `SASLResponse` message.
///
/// The server will reply with an `AuthenticationSASLFinal` message. Its contents should be passed
/// to the `finish()` method method, after which the authentication process is complete.
/// to the `finish()` method, after which the authentication process is complete.
pub struct ScramSha256 {
message: String,
state: State,
@@ -86,7 +86,7 @@ pub struct ScramSha256 {
impl ScramSha256 {
/// Constructs a new instance which will use the provided password for authentication.
pub fn new(password: &[u8]) -> io::Result<ScramSha256> {
let mut rng = try!(OsRng::new());
let mut rng = OsRng::new()?;
let nonce = (0..NONCE_LENGTH)
.map(|_| {
let mut v = rng.gen_range(0x21u8, 0x7e);