Skip to content

Commit 3d2b67a

Browse files
committed
Upgrade to Rust 1.85 and edition 2024
1 parent 0940c18 commit 3d2b67a

File tree

267 files changed

+905
-814
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

267 files changed

+905
-814
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on:
44
push:
55
branches:
66
- main
7-
- 'release/**'
7+
- "release/**"
88
tags:
9-
- 'v*'
9+
- "v*"
1010
pull_request:
1111

1212
concurrency:
@@ -31,10 +31,7 @@ jobs:
3131
- name: Checkout the code
3232
uses: actions/[email protected]
3333

34-
- name: Setup OPA
35-
uses: open-policy-agent/[email protected]
36-
with:
37-
version: 0.70.0
34+
- uses: ./.github/actions/build-policies
3835

3936
- name: Setup Regal
4037
uses: StyraInc/setup-regal@v1
@@ -73,7 +70,6 @@ jobs:
7370
working-directory: ./frontend
7471
run: npm run lint
7572

76-
7773
frontend-test:
7874
name: Run the frontend test suite
7975
runs-on: ubuntu-24.04
@@ -98,7 +94,6 @@ jobs:
9894
working-directory: ./frontend
9995
run: npm test
10096

101-
10297
frontend-knip:
10398
name: Check the frontend for unused dependencies
10499
runs-on: ubuntu-24.04
@@ -123,7 +118,6 @@ jobs:
123118
working-directory: ./frontend
124119
run: npm run knip
125120

126-
127121
rustfmt:
128122
name: Check Rust style
129123
runs-on: ubuntu-24.04
@@ -143,7 +137,6 @@ jobs:
143137
- name: Check style
144138
run: cargo fmt --all -- --check
145139

146-
147140
cargo-deny:
148141
name: Run `cargo deny` checks
149142
runs-on: ubuntu-24.04
@@ -162,7 +155,6 @@ jobs:
162155
- name: Run `cargo-deny`
163156
uses: EmbarkStudios/[email protected]
164157

165-
166158
check-schema:
167159
name: Check schema
168160
runs-on: ubuntu-24.04
@@ -203,7 +195,6 @@ jobs:
203195
exit 1
204196
fi
205197
206-
207198
clippy:
208199
name: Run Clippy
209200
needs: [rustfmt, opa-lint]
@@ -221,14 +212,7 @@ jobs:
221212
with:
222213
components: clippy
223214

224-
- name: Setup OPA
225-
uses: open-policy-agent/[email protected]
226-
with:
227-
version: 0.64.1
228-
229-
- name: Compile OPA policies
230-
working-directory: ./policies
231-
run: make
215+
- uses: ./.github/actions/build-policies
232216

233217
- name: Setup sccache
234218
uses: mozilla-actions/[email protected]
@@ -237,7 +221,6 @@ jobs:
237221
run: |
238222
cargo clippy --workspace --tests --bins --lib -- -D warnings
239223
240-
241224
compile-test-artifacts:
242225
name: Compile test artifacts
243226
runs-on: ubuntu-24.04
@@ -263,15 +246,14 @@ jobs:
263246
- name: Build and archive tests
264247
run: cargo nextest archive --workspace --archive-file nextest-archive.tar.zst
265248
env:
266-
SQLX_OFFLINE: '1'
249+
SQLX_OFFLINE: "1"
267250

268251
- name: Upload archive to workflow
269252
uses: actions/[email protected]
270253
with:
271254
name: nextest-archive
272255
path: nextest-archive.tar.zst
273256

274-
275257
test:
276258
name: Run test suite with Rust stable
277259
needs: [rustfmt, opa-lint, compile-test-artifacts]

.github/workflows/coverage.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Coverage
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88

99
concurrency:
1010
group: ${{ github.workflow }}-${{ github.ref }}
@@ -26,10 +26,7 @@ jobs:
2626
- name: Checkout the code
2727
uses: actions/[email protected]
2828

29-
- name: Setup OPA
30-
uses: open-policy-agent/[email protected]
31-
with:
32-
version: 0.70.0
29+
- uses: ./.github/actions/build-policies
3330

3431
- name: Run OPA tests with coverage
3532
working-directory: ./policies
@@ -119,10 +116,10 @@ jobs:
119116
run: |
120117
cargo test --no-fail-fast --workspace
121118
env:
122-
RUSTFLAGS: '-Cinstrument-coverage'
119+
RUSTFLAGS: "-Cinstrument-coverage"
123120
LLVM_PROFILE_FILE: "cargo-test-%p-%m.profraw"
124121
DATABASE_URL: postgresql://postgres:postgres@localhost/postgres
125-
SQLX_OFFLINE: '1'
122+
SQLX_OFFLINE: "1"
126123

127124
- name: Build grcov report
128125
run: |

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ resolver = "2"
77
package.version = "0.14.1"
88
package.license = "AGPL-3.0-only"
99
package.authors = ["Element Backend Team"]
10-
package.edition = "2021"
10+
package.edition = "2024"
1111
package.homepage = "https://element-hq.github.io/matrix-authentication-service/"
1212
package.repository = "https://github.com/element-hq/matrix-authentication-service/"
1313

1414
[workspace.lints.rust]
15-
unsafe_code = "forbid"
15+
unsafe_code = "deny"
1616

1717
[workspace.lints.clippy]
1818
# We use groups as good defaults, but with a lower priority so that we can override them

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
# The Debian version and version name must be in sync
99
ARG DEBIAN_VERSION=12
1010
ARG DEBIAN_VERSION_NAME=bookworm
11-
ARG RUSTC_VERSION=1.84.0
11+
ARG RUSTC_VERSION=1.85.0
1212
ARG NODEJS_VERSION=20.15.0
13-
ARG OPA_VERSION=0.64.1
13+
ARG OPA_VERSION=1.1.0
1414
ARG CARGO_AUDITABLE_VERSION=0.6.6
1515

1616
##########################################

crates/axum-utils/src/client_authorization.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@
77
use std::collections::HashMap;
88

99
use axum::{
10+
BoxError, Json,
1011
extract::{
11-
rejection::{FailedToDeserializeForm, FormRejection},
1212
Form, FromRequest, FromRequestParts,
13+
rejection::{FailedToDeserializeForm, FormRejection},
1314
},
1415
response::IntoResponse,
15-
BoxError, Json,
1616
};
1717
use axum_extra::typed_header::{TypedHeader, TypedHeaderRejectionReason};
18-
use headers::{authorization::Basic, Authorization};
18+
use headers::{Authorization, authorization::Basic};
1919
use http::{Request, StatusCode};
2020
use mas_data_model::{Client, JwksOrJwksUri};
2121
use mas_http::RequestBuilderExt;
2222
use mas_iana::oauth::OAuthClientAuthenticationMethod;
2323
use mas_jose::{jwk::PublicJsonWebKeySet, jwt::Jwt};
2424
use mas_keystore::Encrypter;
25-
use mas_storage::{oauth2::OAuth2ClientRepository, RepositoryAccess};
25+
use mas_storage::{RepositoryAccess, oauth2::OAuth2ClientRepository};
2626
use oauth2_types::errors::{ClientError, ClientErrorCode};
27-
use serde::{de::DeserializeOwned, Deserialize};
27+
use serde::{Deserialize, de::DeserializeOwned};
2828
use serde_json::Value;
2929
use thiserror::Error;
3030

@@ -371,7 +371,7 @@ where
371371
Err(FormRejection::InvalidFormContentType(_err)) => (None, None, None, None, None),
372372
// If the form could not be read, return a Bad Request error
373373
Err(FormRejection::FailedToDeserializeForm(err)) => {
374-
return Err(ClientAuthorizationError::BadForm(err))
374+
return Err(ClientAuthorizationError::BadForm(err));
375375
}
376376
// Other errors (body read twice, byte stream broke) return an internal error
377377
Err(e) => return Err(ClientAuthorizationError::Internal(Box::new(e))),

crates/axum-utils/src/cookies.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use axum::{
1414
};
1515
use axum_extra::extract::cookie::{Cookie, Key, PrivateCookieJar, SameSite};
1616
use http::request::Parts;
17-
use serde::{de::DeserializeOwned, Serialize};
17+
use serde::{Serialize, de::DeserializeOwned};
1818
use thiserror::Error;
1919
use url::Url;
2020

crates/axum-utils/src/csrf.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
// Please see LICENSE in the repository root for full details.
66

77
use chrono::{DateTime, Duration, Utc};
8-
use data_encoding::{DecodeError, BASE64URL_NOPAD};
8+
use data_encoding::{BASE64URL_NOPAD, DecodeError};
99
use mas_storage::Clock;
10-
use rand::{Rng, RngCore};
10+
use rand::{Rng, RngCore, distributions::Standard, prelude::Distribution as _};
1111
use serde::{Deserialize, Serialize};
12-
use serde_with::{serde_as, TimestampSeconds};
12+
use serde_with::{TimestampSeconds, serde_as};
1313
use thiserror::Error;
1414

1515
use crate::cookies::{CookieDecodeError, CookieJar};
@@ -56,7 +56,7 @@ impl CsrfToken {
5656

5757
/// Generate a new random token valid for a specified duration
5858
fn generate(now: DateTime<Utc>, mut rng: impl Rng, ttl: Duration) -> Self {
59-
let token = rng.gen();
59+
let token = Standard.sample(&mut rng);
6060
Self::new(token, now, ttl)
6161
}
6262

crates/axum-utils/src/fancy_error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
// Please see LICENSE in the repository root for full details.
66

77
use axum::{
8+
Extension,
89
http::StatusCode,
910
response::{IntoResponse, Response},
10-
Extension,
1111
};
1212
use axum_extra::typed_header::TypedHeader;
1313
use headers::ContentType;

crates/axum-utils/src/language_detection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use std::cmp::Reverse;
88

99
use headers::{Error, Header};
10-
use http::{header::ACCEPT_LANGUAGE, HeaderName, HeaderValue};
10+
use http::{HeaderName, HeaderValue, header::ACCEPT_LANGUAGE};
1111
use icu_locid::Locale;
1212

1313
#[derive(PartialEq, Eq, Debug)]
@@ -155,7 +155,7 @@ impl Header for AcceptLanguage {
155155
#[cfg(test)]
156156
mod tests {
157157
use headers::HeaderMapExt;
158-
use http::{header::ACCEPT_LANGUAGE, HeaderMap, HeaderValue};
158+
use http::{HeaderMap, HeaderValue, header::ACCEPT_LANGUAGE};
159159
use icu_locid::locale;
160160

161161
use super::*;

crates/axum-utils/src/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Please see LICENSE in the repository root for full details.
66

77
use mas_data_model::BrowserSession;
8-
use mas_storage::{user::BrowserSessionRepository, RepositoryAccess};
8+
use mas_storage::{RepositoryAccess, user::BrowserSessionRepository};
99
use serde::{Deserialize, Serialize};
1010
use ulid::Ulid;
1111

0 commit comments

Comments
 (0)