Skip to content

Commit eb06313

Browse files
committed
team_repo: Avoid automock for release builds
1 parent af75859 commit eb06313

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ unicode-xid = "=0.2.6"
124124
bytes = "=1.8.0"
125125
crates_io_index = { path = "crates/crates_io_index", features = ["testing"] }
126126
crates_io_tarball = { path = "crates/crates_io_tarball", features = ["builder"] }
127+
crates_io_team_repo = { path = "crates/crates_io_team_repo", features = ["mock"] }
127128
crates_io_test_db = { path = "crates/crates_io_test_db" }
128129
claims = "=0.7.1"
129130
diesel = { version = "=2.2.4", features = ["r2d2"] }

crates/crates_io_team_repo/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ edition = "2021"
77
[lints]
88
workspace = true
99

10+
[features]
11+
mock = ["mockall"]
12+
1013
[dependencies]
1114
anyhow = "=1.0.93"
1215
async-trait = "=0.1.83"
13-
mockall = "=0.13.0"
16+
mockall = { version = "=0.13.0", optional = true }
1417
reqwest = { version = "=0.12.9", features = ["gzip", "json"] }
1518
serde = { version = "=1.0.214", features = ["derive"] }
1619

crates/crates_io_team_repo/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
//! the trait.
77
88
use async_trait::async_trait;
9-
use mockall::automock;
109
use reqwest::{Certificate, Client};
1110
use serde::Deserialize;
1211

1312
mod certs;
1413

15-
#[automock]
14+
#[cfg_attr(feature = "mock", mockall::automock)]
1615
#[async_trait]
1716
pub trait TeamRepo {
1817
async fn get_permission(&self, name: &str) -> anyhow::Result<Permission>;

0 commit comments

Comments
 (0)