Skip to content

Commit 3202c1f

Browse files
authored
chore: updates for cargo release (#2234)
chore: updates for cargo release
1 parent 525dba3 commit 3202c1f

9 files changed

Lines changed: 59 additions & 4 deletions

File tree

.github/workflows/main-workflow.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,45 @@ jobs:
212212
- name: Rust Clippy ${{ matrix.target }}
213213
run: make clippy_${{ matrix.target }}
214214

215+
# Rust clippy release mode lint checker
216+
clippy-release:
217+
needs: rust-env
218+
runs-on: ubuntu-latest
219+
permissions:
220+
contents: read
221+
strategy:
222+
matrix:
223+
target: [spanner, mysql, postgres]
224+
steps:
225+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
226+
with:
227+
persist-credentials: false
228+
229+
- name: Restore Rust toolchain
230+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
231+
with:
232+
path: |
233+
~/.rustup/toolchains
234+
~/.rustup/update-hashes
235+
key: ${{ runner.os }}-rust-toolchain-${{ env.RUST_VERSION }}
236+
237+
- name: Restore Rust cache
238+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
239+
with:
240+
path: |
241+
~/.cargo/registry
242+
~/.cargo/git
243+
target
244+
key: ${{ runner.os }}-cargo-release-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
245+
restore-keys: |
246+
${{ runner.os }}-cargo-release-${{ matrix.target }}-
247+
248+
- name: Set Rust toolchain
249+
run: rustup default ${{ env.RUST_VERSION }}
250+
251+
- name: Rust Clippy release ${{ matrix.target }}
252+
run: make clippy_release_${{ matrix.target }}
253+
215254
# Postgres unit tests ======
216255
build-and-unit-test-postgres:
217256
needs: [rust-env, python-env]

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@ clippy_spanner:
6666
# Matches what's run in circleci
6767
cargo clippy --workspace --all-targets --no-default-features --features=syncstorage-db/spanner --features=py_verifier -- -D clippy::dbg_macro -D warnings
6868

69+
clippy_release_mysql:
70+
# Release mode clippy — catches dead code and issues only visible with optimizations
71+
cargo clippy --release --workspace --no-default-features --features=syncstorage-db/mysql --features=py_verifier -- -D warnings
72+
73+
clippy_release_postgres:
74+
# Release mode clippy — catches dead code and issues only visible with optimizations
75+
cargo clippy --release --workspace --no-default-features --features=syncstorage-db/postgres --features=tokenserver-db/postgres --features=py_verifier -- -D warnings
76+
77+
clippy_release_spanner:
78+
# Release mode clippy — catches dead code and issues only visible with optimizations
79+
cargo clippy --release --workspace --no-default-features --features=syncstorage-db/spanner --features=py_verifier -- -D warnings
80+
6981
clean:
7082
cargo clean
7183

syncstorage-mysql/src/pool.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ impl CollectionCache {
216216
.cloned())
217217
}
218218

219+
#[allow(dead_code)]
219220
pub fn clear(&self) {
220221
self.by_name.write().expect("by_name write").clear();
221222
self.by_id.write().expect("by_id write").clear();

syncstorage-postgres/src/pool.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ impl CollectionCache {
212212
.cloned())
213213
}
214214

215+
#[allow(dead_code)]
215216
pub fn clear(&self) {
216217
self.by_name.write().expect("by_name write").clear();
217218
self.by_id.write().expect("by_id write").clear();

syncstorage-spanner/src/pool.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ impl CollectionCache {
190190
(names, missing)
191191
}
192192

193+
#[allow(dead_code)]
193194
pub async fn clear(&self) {
194195
self.by_name.write().await.clear();
195196
self.by_id.write().await.clear();

tokenserver-mysql/src/db/db_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl Db for TokenserverDb {
9797
AND replaced_at IS NULL
9898
"#;
9999

100-
let now = chrono::Utc::now().timestamp_millis();
100+
let now = Utc::now().timestamp_millis();
101101

102102
diesel::sql_query(QUERY)
103103
.bind::<Bigint, _>(tokenserver_db_common::MAX_GENERATION)

tokenserver-mysql/src/db/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ impl TokenserverDb {
2020
// most recently-inserted record *for a given connection*. If connections were shared across
2121
// requests, using this function would introduce a race condition, as we could potentially
2222
// get IDs from records created during other requests.
23+
#[allow(dead_code)]
2324
const LAST_INSERT_ID_QUERY: &'static str = "SELECT LAST_INSERT_ID() AS id";
2425
const LAST_INSERT_UID_QUERY: &'static str = "SELECT LAST_INSERT_ID() AS uid";
2526

tokenserver-postgres/src/db/db_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ impl Db for TokenserverPgDb {
486486
AND replaced_at IS NULL
487487
"#;
488488

489-
let now = chrono::Utc::now().timestamp_millis();
489+
let now = Utc::now().timestamp_millis();
490490

491491
diesel::sql_query(QUERY)
492492
.bind::<BigInt, _>(tokenserver_db_common::MAX_GENERATION)

0 commit comments

Comments
 (0)