Skip to content
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 crates/database/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ impl Database {
}
}

#[cfg(feature = "test-util")]
#[cfg(any(test, feature = "test-util"))]
impl Database {
/// Connects to `config`'s database in a schema of its own, created and migrated
/// for this call, so a test can change history that the whole database shares,
Expand Down
4 changes: 2 additions & 2 deletions crates/database/src/exclusive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ pub enum LockKey {
/// overlapping `migrate` runs take turns.
Migrations = 7,
/// The job runner panic test; no release takes it.
#[cfg(feature = "test-util")]
#[cfg(any(test, feature = "test-util"))]
Test = -1,
/// The job runner exclusivity test, apart from [`Self::Test`] since tests
/// sharing a database run at once; no release takes it.
#[cfg(feature = "test-util")]
#[cfg(any(test, feature = "test-util"))]
ExclusivityTest = -2,
}

Expand Down
2 changes: 1 addition & 1 deletion crates/database/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub use connection::{Database, DatabaseConfig, RuntimeRole};
pub(crate) use connection::{Limit, Scope};
pub use error::{DatabaseConnectionError, DatabaseError};
pub use exclusive::{ExclusiveConnection, LockKey};
#[cfg(feature = "test-util")]
#[cfg(any(test, feature = "test-util"))]
pub use repositories::audit::Tamper;
pub use repositories::{
AccountDeletionRepository, AdministratorRepository, AuditRepository, DashboardRepository,
Expand Down
4 changes: 2 additions & 2 deletions crates/database/src/repositories/audit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ impl DatabaseTransaction<'_> {
/// A change an attacker with database access could make, for verification tests.
/// [`AuditRepository::tamper`] applies it with the guard triggers disabled, so run
/// it only on a database of its own (see `Database::isolated`).
#[cfg(feature = "test-util")]
#[cfg(any(test, feature = "test-util"))]
#[derive(Clone, Debug)]
pub enum Tamper {
/// Replaces the payload of the event at a position.
Expand All @@ -516,7 +516,7 @@ pub enum Tamper {
ErasePersonalData(u64),
}

#[cfg(feature = "test-util")]
#[cfg(any(test, feature = "test-util"))]
impl AuditRepository<'_> {
/// Applies `tamper` with the guard triggers disabled.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/database/src/repositories/deliveries/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ impl DeliveryRepository<'_> {
/// # Errors
///
/// Returns [`DatabaseError`] if the query fails.
#[cfg(feature = "test-util")]
#[cfg(any(test, feature = "test-util"))]
pub async fn payloads(
&mut self,
destination: &str,
Expand Down
2 changes: 1 addition & 1 deletion crates/database/src/repositories/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ impl EventRepository<'_> {
/// # Errors
///
/// Returns [`DatabaseError`] if the query fails or a stored event does not decode.
#[cfg(feature = "test-util")]
#[cfg(any(test, feature = "test-util"))]
pub async fn history_for_client(
&mut self,
client_id: &ClientId,
Expand Down
4 changes: 2 additions & 2 deletions crates/database/src/repositories/recoveries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ impl RecoveryRepository<'_> {
/// # Errors
///
/// Returns [`DatabaseError`] if the update fails.
#[cfg(feature = "test-util")]
#[cfg(any(test, feature = "test-util"))]
pub async fn expire(&mut self, id: RecoveryId) -> Result<(), DatabaseError> {
run!(
self,
Expand All @@ -439,7 +439,7 @@ impl RecoveryRepository<'_> {
/// # Errors
///
/// Returns [`DatabaseError`] if the update fails.
#[cfg(feature = "test-util")]
#[cfg(any(test, feature = "test-util"))]
pub async fn backdate_completion(
&mut self,
id: RecoveryId,
Expand Down
2 changes: 1 addition & 1 deletion crates/database/src/repositories/tokens/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ impl TokenRepository<'_> {
/// # Errors
///
/// Returns [`DatabaseError`] if the query fails.
#[cfg(feature = "test-util")]
#[cfg(any(test, feature = "test-util"))]
pub async fn lock_family(&mut self, id: TokenId) -> Result<(), DatabaseError> {
run!(
self,
Expand Down
2 changes: 1 addition & 1 deletion crates/database/src/repositories/users/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ impl UserRepository<'_> {
/// # Errors
///
/// Returns [`DatabaseError`] if the query fails.
#[cfg(feature = "test-util")]
#[cfg(any(test, feature = "test-util"))]
pub async fn age_handle_change(&mut self, id: UserId, days: i32) -> Result<(), DatabaseError> {
run!(
self,
Expand Down
2 changes: 1 addition & 1 deletion crates/database/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl<'a> DatabaseTransaction<'a> {
/// # Errors
///
/// Returns [`DatabaseError`] if the query fails.
#[cfg(feature = "test-util")]
#[cfg(any(test, feature = "test-util"))]
pub async fn blocked_transactions(&mut self) -> Result<i64, DatabaseError> {
sqlx::query_scalar!(
// `pg_locks` is read afresh by every query; `pg_stat_activity` would
Expand Down
10 changes: 9 additions & 1 deletion just/rust.just
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ fmt:
fmt-check:
@cargo fmt --all -- --check

# The workspace pass unifies features, so a crate's own tests can compile only
# because another crate's dev-dependency enables a feature such as `test-util`.
# Linting each crate alone too catches that.
lint:
@cargo clippy --locked --workspace --all-targets -- -D warnings
#!/usr/bin/env bash
set -euo pipefail
cargo clippy --locked --workspace --all-targets -- -D warnings
for manifest in apps/*/Cargo.toml crates/*/Cargo.toml; do
cargo clippy --locked --manifest-path "$manifest" --all-targets -- -D warnings
done

# Dependencies a crate declares but never names, by cargo-machete.
unused:
Expand Down
Loading