1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-29 22:01:14 +03:00

Update Rust to 1.69.0

This commit is contained in:
Quentin Gliech
2023-04-24 11:01:59 +02:00
parent a6d1410146
commit 3979e9f46a
7 changed files with 25 additions and 42 deletions

View File

@ -130,7 +130,7 @@ fn stdout_tracer() -> Tracer {
}
#[cfg(feature = "otlp")]
fn otlp_tracer(endpoint: &Option<Url>) -> anyhow::Result<Tracer> {
fn otlp_tracer(endpoint: Option<&Url>) -> anyhow::Result<Tracer> {
use opentelemetry_otlp::WithExportConfig;
let mut exporter = opentelemetry_otlp::new_exporter().tonic();
@ -149,15 +149,14 @@ fn otlp_tracer(endpoint: &Option<Url>) -> anyhow::Result<Tracer> {
}
#[cfg(not(feature = "otlp"))]
fn otlp_tracer(endpoint: &Option<Url>) -> anyhow::Result<Tracer> {
let _ = endpoint;
#[allow(unused_variables)]
fn otlp_tracer(endpoint: Option<&Url>) -> anyhow::Result<Tracer> {
anyhow::bail!("The service was compiled without OTLP exporter support, but config exports traces via OTLP.")
}
#[cfg(not(feature = "jaeger"))]
#[allow(unused_variables)]
fn jaeger_agent_tracer(host: &str, port: u16) -> anyhow::Result<Tracer> {
let _ = host;
let _ = port;
anyhow::bail!("The service was compiled without Jaeger exporter support, but config exports traces via Jaeger.")
}
@ -176,15 +175,12 @@ fn jaeger_agent_tracer(host: &str, port: u16) -> anyhow::Result<Tracer> {
}
#[cfg(not(feature = "jaeger"))]
#[allow(unused_variables, clippy::unused_async)]
async fn jaeger_collector_tracer(
endpoint: &str,
username: Option<&str>,
password: Option<&str>,
) -> anyhow::Result<Tracer> {
let _ = endpoint;
let _ = username;
let _ = password;
futures_util::future::ready(()).await; // Silence the "unused async" lint
anyhow::bail!("The service was compiled without Jaeger exporter support, but config exports traces via Jaeger.")
}
@ -217,9 +213,8 @@ async fn jaeger_collector_tracer(
}
#[cfg(not(feature = "zipkin"))]
#[allow(unused_variables, clippy::unused_async)]
async fn zipkin_tracer(collector_endpoint: &Option<Url>) -> anyhow::Result<Tracer> {
let _ = collector_endpoint;
futures_util::future::ready(()).await; // Silence the "unused async" lint
anyhow::bail!("The service was compiled without Jaeger exporter support, but config exports traces via Jaeger.")
}
@ -247,7 +242,7 @@ async fn tracer(config: &TracingExporterConfig) -> anyhow::Result<Option<Tracer>
let tracer = match config {
TracingExporterConfig::None => return Ok(None),
TracingExporterConfig::Stdout => stdout_tracer(),
TracingExporterConfig::Otlp { endpoint } => otlp_tracer(endpoint)?,
TracingExporterConfig::Otlp { endpoint } => otlp_tracer(endpoint.as_ref())?,
TracingExporterConfig::Jaeger(JaegerExporterProtocolConfig::UdpThriftCompact {
agent_host,
agent_port,
@ -266,7 +261,7 @@ async fn tracer(config: &TracingExporterConfig) -> anyhow::Result<Option<Tracer>
}
#[cfg(feature = "otlp")]
fn otlp_meter(endpoint: &Option<url::Url>) -> anyhow::Result<BasicController> {
fn otlp_meter(endpoint: Option<&url::Url>) -> anyhow::Result<BasicController> {
use opentelemetry_otlp::WithExportConfig;
let mut exporter = opentelemetry_otlp::new_exporter().tonic();
@ -289,8 +284,8 @@ fn otlp_meter(endpoint: &Option<url::Url>) -> anyhow::Result<BasicController> {
}
#[cfg(not(feature = "otlp"))]
fn otlp_meter(endpoint: &Option<url::Url>) -> anyhow::Result<BasicController> {
let _ = endpoint;
#[allow(unused_variables)]
fn otlp_meter(endpoint: Option<&url::Url>) -> anyhow::Result<BasicController> {
anyhow::bail!("The service was compiled without OTLP exporter support, but config exports metrics via OTLP.")
}
@ -396,7 +391,7 @@ fn meter(config: &MetricsExporterConfig) -> anyhow::Result<Option<BasicControlle
let controller = match config {
MetricsExporterConfig::None => None,
MetricsExporterConfig::Stdout => Some(stdout_meter()?),
MetricsExporterConfig::Otlp { endpoint } => Some(otlp_meter(endpoint)?),
MetricsExporterConfig::Otlp { endpoint } => Some(otlp_meter(endpoint.as_ref())?),
MetricsExporterConfig::Prometheus => Some(prometheus_meter()?),
};

View File

@ -188,7 +188,7 @@ pub async fn post(
existing_params,
login_token: &login.login_token,
};
let query = serde_urlencoded::to_string(&params)?;
let query = serde_urlencoded::to_string(params)?;
redirect_uri.set_query(Some(&query));
redirect_uri
};

View File

@ -42,8 +42,11 @@ use crate::{
MatrixHomeserver,
};
// This might fail if it's not the first time it's being called, which is fine,
// so we ignore the result
#[allow(unused_must_use)]
pub(crate) fn init_tracing() {
let _ = tracing_subscriber::fmt()
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
.with_test_writer()
.try_init();

View File

@ -46,8 +46,6 @@ mod tests {
#[sqlx::test(migrator = "crate::MIGRATOR")]
async fn test_session_repository(pool: PgPool) {
const FIRST_TOKEN: &str = "first_access_token";
const SECOND_TOKEN: &str = "second_access_token";
let mut rng = ChaChaRng::seed_from_u64(42);
let clock = MockClock::default();
let mut repo = PgRepository::from_pool(&pool).await.unwrap();

View File

@ -82,11 +82,9 @@ impl State {
&self.mailer
}
// This is fine for now, we may move that to a trait at some point.
#[allow(clippy::unused_self, clippy::disallowed_methods)]
pub fn rng(&self) -> rand_chacha::ChaChaRng {
let _ = self;
// This is fine.
#[allow(clippy::disallowed_methods)]
rand_chacha::ChaChaRng::from_rng(rand::thread_rng()).expect("failed to seed rng")
}