1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-20 12:02:22 +03:00

handlers: remove most usage of anyhow

This commit is contained in:
Quentin Gliech
2022-12-08 12:46:56 +01:00
parent a836cc864a
commit 68890b7291
24 changed files with 100 additions and 139 deletions

View File

@@ -26,7 +26,6 @@
use std::{convert::Infallible, sync::Arc, time::Duration};
use anyhow::Context;
use axum::{
body::{Bytes, HttpBody},
extract::FromRef,
@@ -402,13 +401,14 @@ async fn test_state(pool: PgPool) -> Result<AppState, anyhow::Error> {
}
// XXX: that should be moved somewhere else
fn rng_and_clock() -> Result<(mas_storage::Clock, rand_chacha::ChaChaRng), anyhow::Error> {
fn clock_and_rng() -> (mas_storage::Clock, rand_chacha::ChaChaRng) {
let clock = mas_storage::Clock::default();
// This rng is used to source the local rng
#[allow(clippy::disallowed_methods)]
let rng = rand::thread_rng();
let rng = rand_chacha::ChaChaRng::from_rng(rng).context("Failed to seed RNG")?;
Ok((clock, rng))
let rng = rand_chacha::ChaChaRng::from_rng(rng).expect("Failed to seed RNG");
(clock, rng)
}