Skip to content

chore: bump edition for all crates to 2024 #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "api"
version = "0.1.0"
edition = "2021"
edition = "2024"

[lib]
path = "src/lib.rs"
Expand Down
4 changes: 2 additions & 2 deletions api/src/authentication.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use actix_web::{dev::ServiceRequest, web::Data, Error};
use actix_web::{Error, dev::ServiceRequest, web::Data};
use actix_web_httpauth::extractors::{
bearer::{BearerAuth, Config},
AuthenticationError,
bearer::{BearerAuth, Config},
};
use constant_time_eq::constant_time_eq_n;

Expand Down
4 changes: 2 additions & 2 deletions api/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use base64::{prelude::BASE64_STANDARD, Engine};
use base64::{Engine, prelude::BASE64_STANDARD};
use config::shared::PgConnectionConfig;
use serde::de::{MapAccess, Visitor};
use serde::{de, Deserialize, Deserializer};
use serde::{Deserialize, Deserializer, de};
use std::fmt;
use thiserror::Error;

Expand Down
12 changes: 6 additions & 6 deletions api/src/db/destinations.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
use config::shared::DestinationConfig;
use config::SerializableSecretString;
use config::shared::DestinationConfig;
use secrecy::ExposeSecret;
use serde::{Deserialize, Serialize};
use sqlx::{PgPool, Postgres, Transaction};
use std::fmt::Debug;
use thiserror::Error;

use crate::db::serde::{
decrypt_and_deserialize_from_value, encrypt_and_serialize, DbDeserializationError,
DbSerializationError,
DbDeserializationError, DbSerializationError, decrypt_and_deserialize_from_value,
encrypt_and_serialize,
};
use crate::encryption::{
decrypt_text, encrypt_text, Decrypt, DecryptionError, Encrypt, EncryptedValue, EncryptionError,
EncryptionKey,
Decrypt, DecryptionError, Encrypt, EncryptedValue, EncryptionError, EncryptionKey,
decrypt_text, encrypt_text,
};

impl Encrypt<EncryptedDestinationConfig> for DestinationConfig {
Expand Down Expand Up @@ -300,8 +300,8 @@ pub async fn destination_exists(
#[cfg(test)]
mod tests {
use aws_lc_rs::aead::RandomizedNonceKey;
use config::shared::DestinationConfig;
use config::SerializableSecretString;
use config::shared::DestinationConfig;

use crate::db::destinations::EncryptedDestinationConfig;
use crate::db::serde::{decrypt_and_deserialize_from_value, encrypt_and_serialize};
Expand Down
6 changes: 3 additions & 3 deletions api/src/db/destinations_pipelines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ use sqlx::PgPool;
use thiserror::Error;

use crate::db::destinations::{
create_destination_txn, update_destination_txn, DestinationsDbError,
DestinationsDbError, create_destination_txn, update_destination_txn,
};
use crate::db::pipelines::{
create_pipeline_txn, update_pipeline_txn, PipelineConfig, PipelinesDbError,
PipelineConfig, PipelinesDbError, create_pipeline_txn, update_pipeline_txn,
};
use crate::db::serde::{
encrypt_and_serialize, serialize, DbDeserializationError, DbSerializationError,
DbDeserializationError, DbSerializationError, encrypt_and_serialize, serialize,
};
use crate::encryption::EncryptionKey;

Expand Down
6 changes: 3 additions & 3 deletions api/src/db/pipelines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use serde::{Deserialize, Serialize};
use sqlx::{PgPool, Postgres, Transaction};
use thiserror::Error;

use crate::db::replicators::{create_replicator_txn, ReplicatorsDbError};
use crate::db::replicators::{ReplicatorsDbError, create_replicator_txn};
use crate::db::serde::{
deserialize_from_value, serialize, DbDeserializationError, DbSerializationError,
DbDeserializationError, DbSerializationError, deserialize_from_value, serialize,
};

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down Expand Up @@ -277,7 +277,7 @@ pub async fn read_all_pipelines(
/// Helper function to check if an sqlx error is a duplicate pipeline constraint violation
pub fn is_duplicate_pipeline_error(err: &sqlx::Error) -> bool {
match err {
sqlx::Error::Database(ref db_err) => {
sqlx::Error::Database(db_err) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling out a few places where upgrading the edition caused compiler errors to make it easy to review. The rest of the noise is mostly due to clippy warning fixes or cargo fmt changes.

// 23505 is PostgreSQL's unique constraint violation code
// Check for our unique constraint name defined
// in the migrations/20250605064229_add_unique_constraint_pipelines_source_destination.sql file
Expand Down
2 changes: 1 addition & 1 deletion api/src/db/publications.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use pg_escape::{quote_identifier, quote_literal};
use serde::Serialize;
use sqlx::{postgres::PgConnectOptions, Connection, Executor, PgConnection, Row};
use sqlx::{Connection, Executor, PgConnection, Row, postgres::PgConnectOptions};
use std::collections::HashMap;
use thiserror::Error;
use utoipa::ToSchema;
Expand Down
2 changes: 1 addition & 1 deletion api/src/db/serde.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use serde::de::DeserializeOwned;
use serde::Serialize;
use serde::de::DeserializeOwned;
use thiserror::Error;

use crate::encryption::{Decrypt, DecryptionError, Encrypt, EncryptionError, EncryptionKey};
Expand Down
10 changes: 5 additions & 5 deletions api/src/db/sources.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
use config::shared::{PgConnectionConfig, TlsConfig};
use config::SerializableSecretString;
use config::shared::{PgConnectionConfig, TlsConfig};
use secrecy::ExposeSecret;
use serde::{Deserialize, Serialize};
use sqlx::{PgPool, Postgres, Transaction};
use std::fmt::Debug;
use thiserror::Error;

use crate::db::serde::{
decrypt_and_deserialize_from_value, encrypt_and_serialize, DbDeserializationError,
DbSerializationError,
DbDeserializationError, DbSerializationError, decrypt_and_deserialize_from_value,
encrypt_and_serialize,
};
use crate::encryption::{
decrypt_text, encrypt_text, Decrypt, DecryptionError, Encrypt, EncryptedValue, EncryptionError,
EncryptionKey,
Decrypt, DecryptionError, Encrypt, EncryptedValue, EncryptionError, EncryptionKey,
decrypt_text, encrypt_text,
};

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion api/src/db/tables.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use serde::{Deserialize, Serialize};
use sqlx::{postgres::PgConnectOptions, Connection, Executor, PgConnection, Row};
use sqlx::{Connection, Executor, PgConnection, Row, postgres::PgConnectOptions};
use thiserror::Error;

#[derive(Debug, Error)]
Expand Down
6 changes: 3 additions & 3 deletions api/src/db/tenants_sources.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use sqlx::PgPool;
use thiserror::Error;

use crate::db::serde::{encrypt_and_serialize, DbSerializationError};
use crate::db::sources::{create_source_txn, SourceConfig, SourcesDbError};
use crate::db::tenants::{create_tenant_txn, TenantsDbError};
use crate::db::serde::{DbSerializationError, encrypt_and_serialize};
use crate::db::sources::{SourceConfig, SourcesDbError, create_source_txn};
use crate::db::tenants::{TenantsDbError, create_tenant_txn};
use crate::encryption::EncryptionKey;

#[derive(Debug, Error)]
Expand Down
8 changes: 4 additions & 4 deletions api/src/encryption.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use aws_lc_rs::{
aead::{Aad, Nonce, RandomizedNonceKey, AES_256_GCM},
aead::{AES_256_GCM, Aad, Nonce, RandomizedNonceKey},
rand::fill,
};
use base64::prelude::BASE64_STANDARD;
use base64::Engine;
use base64::prelude::BASE64_STANDARD;
use serde::{Deserialize, Serialize};
use std::string;
use thiserror::Error;
Expand Down Expand Up @@ -144,8 +144,8 @@ fn decrypt(
/// # Panics
///
/// Panics if `T` does not match the required key length for the cipher.
pub fn generate_random_key<const T: usize>(
) -> Result<RandomizedNonceKey, aws_lc_rs::error::Unspecified> {
pub fn generate_random_key<const T: usize>()
-> Result<RandomizedNonceKey, aws_lc_rs::error::Unspecified> {
let mut key_bytes = [0u8; T];
fill(&mut key_bytes)?;

Expand Down
4 changes: 2 additions & 2 deletions api/src/k8s_client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_trait::async_trait;
use base64::{prelude::BASE64_STANDARD, Engine};
use base64::{Engine, prelude::BASE64_STANDARD};
use k8s_openapi::api::{
apps::v1::StatefulSet,
core::v1::{ConfigMap, Pod, Secret},
Expand All @@ -9,8 +9,8 @@ use thiserror::Error;
use tracing::*;

use kube::{
api::{Api, DeleteParams, Patch, PatchParams},
Client,
api::{Api, DeleteParams, Patch, PatchParams},
};

#[derive(Debug, Error)]
Expand Down
7 changes: 3 additions & 4 deletions api/src/routes/destinations.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use actix_web::{
delete, get,
http::{header::ContentType, StatusCode},
HttpRequest, HttpResponse, Responder, ResponseError, delete, get,
http::{StatusCode, header::ContentType},
post,
web::{Data, Json, Path},
HttpRequest, HttpResponse, Responder, ResponseError,
};
use config::shared::DestinationConfig;
use serde::{Deserialize, Serialize};
Expand All @@ -14,7 +13,7 @@ use utoipa::ToSchema;
use crate::db;
use crate::db::destinations::DestinationsDbError;
use crate::encryption::EncryptionKey;
use crate::routes::{extract_tenant_id, ErrorMessage, TenantIdError};
use crate::routes::{ErrorMessage, TenantIdError, extract_tenant_id};

#[derive(Debug, Error)]
pub enum DestinationError {
Expand Down
10 changes: 5 additions & 5 deletions api/src/routes/destinations_pipelines.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use actix_web::{
http::{header::ContentType, StatusCode},
HttpRequest, HttpResponse, Responder, ResponseError,
http::{StatusCode, header::ContentType},
post,
web::{Data, Json, Path},
HttpRequest, HttpResponse, Responder, ResponseError,
};
use config::shared::DestinationConfig;
use serde::{Deserialize, Serialize};
Expand All @@ -11,14 +11,14 @@ use thiserror::Error;
use utoipa::ToSchema;

use crate::db;
use crate::db::destinations::{destination_exists, DestinationsDbError};
use crate::db::destinations::{DestinationsDbError, destination_exists};
use crate::db::destinations_pipelines::DestinationPipelinesDbError;
use crate::db::images::ImagesDbError;
use crate::db::pipelines::PipelineConfig;
use crate::db::sources::{source_exists, SourcesDbError};
use crate::db::sources::{SourcesDbError, source_exists};
use crate::encryption::EncryptionKey;

use super::{destinations::DestinationError, extract_tenant_id, ErrorMessage, TenantIdError};
use super::{ErrorMessage, TenantIdError, destinations::DestinationError, extract_tenant_id};

#[derive(Debug, Error)]
enum DestinationPipelineError {
Expand Down
2 changes: 1 addition & 1 deletion api/src/routes/health_check.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use actix_web::{get, HttpResponse, Responder};
use actix_web::{HttpResponse, Responder, get};

#[utoipa::path(
tag = "Health",
Expand Down
5 changes: 2 additions & 3 deletions api/src/routes/images.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use actix_web::{
delete, get,
http::{header::ContentType, StatusCode},
HttpResponse, Responder, ResponseError, delete, get,
http::{StatusCode, header::ContentType},
post,
web::{Data, Json, Path},
HttpResponse, Responder, ResponseError,
};
use serde::{Deserialize, Serialize};
use sqlx::PgPool;
Expand Down
11 changes: 5 additions & 6 deletions api/src/routes/pipelines.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use actix_web::{
delete, get,
http::{header::ContentType, StatusCode},
HttpRequest, HttpResponse, Responder, ResponseError, delete, get,
http::{StatusCode, header::ContentType},
post,
web::{Data, Json, Path},
HttpRequest, HttpResponse, Responder, ResponseError,
};
use config::shared::{
DestinationConfig, PgConnectionConfig, PipelineConfig as SharedPipelineConfig,
Expand All @@ -16,16 +15,16 @@ use thiserror::Error;
use utoipa::ToSchema;

use crate::db;
use crate::db::destinations::{destination_exists, Destination, DestinationsDbError};
use crate::db::destinations::{Destination, DestinationsDbError, destination_exists};
use crate::db::images::{Image, ImagesDbError};
use crate::db::pipelines::{Pipeline, PipelineConfig, PipelinesDbError};
use crate::db::replicators::{Replicator, ReplicatorsDbError};
use crate::db::sources::{source_exists, Source, SourceConfig, SourcesDbError};
use crate::db::sources::{Source, SourceConfig, SourcesDbError, source_exists};
use crate::encryption::EncryptionKey;
use crate::k8s_client::{
HttpK8sClient, K8sClient, K8sError, PodPhase, TRUSTED_ROOT_CERT_CONFIG_MAP_NAME,
};
use crate::routes::{extract_tenant_id, ErrorMessage, TenantIdError};
use crate::routes::{ErrorMessage, TenantIdError, extract_tenant_id};
use secrecy::ExposeSecret;

#[derive(Debug, Error)]
Expand Down
7 changes: 3 additions & 4 deletions api/src/routes/sources.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use crate::db;
use crate::db::sources::{SourceConfig, SourcesDbError};
use crate::encryption::EncryptionKey;
use crate::routes::{extract_tenant_id, ErrorMessage, TenantIdError};
use crate::routes::{ErrorMessage, TenantIdError, extract_tenant_id};
use actix_web::{
delete, get,
http::{header::ContentType, StatusCode},
HttpRequest, HttpResponse, Responder, ResponseError, delete, get,
http::{StatusCode, header::ContentType},
post,
web::{Data, Json, Path},
HttpRequest, HttpResponse, Responder, ResponseError,
};
use serde::{Deserialize, Serialize};
use sqlx::PgPool;
Expand Down
7 changes: 3 additions & 4 deletions api/src/routes/sources/publications.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use actix_web::{
delete, get,
http::{header::ContentType, StatusCode},
HttpRequest, HttpResponse, Responder, ResponseError, delete, get,
http::{StatusCode, header::ContentType},
post,
web::{Data, Json, Path},
HttpRequest, HttpResponse, Responder, ResponseError,
};
use config::shared::IntoConnectOptions;
use serde::{Deserialize, Serialize};
Expand All @@ -15,7 +14,7 @@ use crate::db::publications::PublicationsDbError;
use crate::{
db::{self, publications::Publication, sources::SourcesDbError, tables::Table},
encryption::EncryptionKey,
routes::{extract_tenant_id, ErrorMessage, TenantIdError},
routes::{ErrorMessage, TenantIdError, extract_tenant_id},
};

#[derive(Debug, Error)]
Expand Down
7 changes: 3 additions & 4 deletions api/src/routes/sources/tables.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use actix_web::{
get,
http::{header::ContentType, StatusCode},
HttpRequest, HttpResponse, Responder, ResponseError, get,
http::{StatusCode, header::ContentType},
web::{Data, Json, Path},
HttpRequest, HttpResponse, Responder, ResponseError,
};
use config::shared::IntoConnectOptions;
use serde::{Deserialize, Serialize};
Expand All @@ -14,7 +13,7 @@ use crate::db::tables::TablesDbError;
use crate::{
db::{self, sources::SourcesDbError, tables::Table},
encryption::EncryptionKey,
routes::{extract_tenant_id, ErrorMessage, TenantIdError},
routes::{ErrorMessage, TenantIdError, extract_tenant_id},
};

#[derive(Debug, Error)]
Expand Down
5 changes: 2 additions & 3 deletions api/src/routes/tenants.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use actix_web::{
delete, get,
http::{header::ContentType, StatusCode},
HttpResponse, Responder, ResponseError, delete, get,
http::{StatusCode, header::ContentType},
post, put,
web::{Data, Json, Path},
HttpResponse, Responder, ResponseError,
};
use serde::{Deserialize, Serialize};
use sqlx::PgPool;
Expand Down
4 changes: 2 additions & 2 deletions api/src/routes/tenants_sources.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use actix_web::{
http::{header::ContentType, StatusCode},
HttpResponse, Responder, ResponseError,
http::{StatusCode, header::ContentType},
post,
web::{Data, Json},
HttpResponse, Responder, ResponseError,
};
use serde::{Deserialize, Serialize};
use sqlx::PgPool;
Expand Down
2 changes: 1 addition & 1 deletion api/src/span_builder.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use actix_web::{
Error,
body::MessageBody,
dev::{ServiceRequest, ServiceResponse},
Error,
};
use tracing::Span;
use tracing_actix_web::{DefaultRootSpanBuilder, RootSpanBuilder};
Expand Down
Loading