Skip to content

Commit 6288567

Browse files
authored
refactor: upgrade to Rust 2024, v1.85 (#92)
1 parent 2dd712f commit 6288567

30 files changed

+61
-46
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717
- uses: EmbarkStudios/cargo-deny-action@v2
18+
with:
19+
rust-version: "1.85"
1820

1921
cargo-fmt-clippy:
2022
runs-on: ubuntu-latest
2123
steps:
2224
- uses: actions/checkout@v4
23-
- name: Print the Rust version
24-
run: rustc --version
25+
- name: Update the Rust toolchain to the latest stable version
26+
run: rustup default 1.85 && rustup component add rustfmt && rustup component add clippy && rustc --version
2527
- name: Cargo formatting check
2628
run: cargo fmt --all -- --check
2729
- name: Cargo clippy check
@@ -33,12 +35,16 @@ jobs:
3335
- uses: actions/checkout@v4
3436
- name: Build and run the docker services
3537
run: docker compose up -d
38+
- name: Update the Rust toolchain to the latest stable version
39+
run: rustup default 1.85 && rustc --version
3640
- name: Run tests
3741
run: cargo test --verbose
3842

3943
build:
4044
runs-on: ubuntu-latest
4145
steps:
4246
- uses: actions/checkout@v4
47+
- name: Update the Rust toolchain to the latest stable version
48+
run: rustup default 1.85 && rustc --version
4349
- name: Build
4450
run: cargo build --verbose

CHANGELOG.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,21 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## 0.1.3 (2025-02-20)
6+
7+
* refactor: upgrade to Rust v1.85, edition 2024
8+
* refactor: error handling
9+
* docs: updated readme, changelog and API documentation
10+
511
## 0.1.2 (2025-01-29)
612

7-
* Added transaction samples.
8-
* Added structured error response.
9-
* Refactored and updated dependencies.
13+
* feat: transaction samples.
14+
* feat: structured error response.
1015

1116
## 0.1.1 (2025-01-04)
1217

13-
* Updated dependencies and fixed breaking changes.
18+
* fix: breaking changes after upgrading to axum 0.8
1419

1520
## 0.1.0 (2023-11-09)
1621

17-
* Project started.
22+
* project started.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[package]
22
name = "axum-web"
33
version = "0.1.3"
4-
edition = "2021"
4+
edition = "2024"
55
authors = ["Sheroz Khaydarov"]
66
description = "A sample starter project for building REST API Web service in Rust using axum, JWT, SQLx, PostgreSQL, and Redis"
77
readme = "README.md"
88
repository = "https://github.com/sheroz/axum-web"
99
license = "MIT"
10-
rust-version = "1.84"
10+
rust-version = "1.85"
1111

1212
[dependencies]
1313
dotenvy = "0.15"

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM rust:1.84 as builder
1+
FROM rust:1.85 as builder
22
WORKDIR /opt
33
COPY . .
44
RUN cargo build --release

clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
msrv = "1.84"
1+
msrv = "1.85"
22

33
disallowed-types = [
44
{ path = "std::collections::LinkedList", reason = "LinkedList as a slow and almost never needed" },

src/api/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use std::fmt::{Display, Formatter, Result};
22

33
use axum::{
4+
Json,
45
http::StatusCode,
56
response::{IntoResponse, Response},
6-
Json,
77
};
88
use chrono::{DateTime, Utc};
99
use serde::{Deserialize, Serialize};

src/api/extractors.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
use std::sync::Arc;
22

33
use axum::{
4+
RequestPartsExt,
45
extract::{FromRef, FromRequestParts},
56
http::request::Parts,
6-
RequestPartsExt,
77
};
88
use axum_extra::{
9-
headers::{authorization::Bearer, Authorization},
109
TypedHeader,
10+
headers::{Authorization, authorization::Bearer},
1111
};
1212

1313
use crate::{
1414
api::APIError,
1515
application::{
1616
security::{
1717
auth::{self, AuthError},
18-
jwt::{decode_token, AccessClaims, ClaimsMethods, RefreshClaims},
18+
jwt::{AccessClaims, ClaimsMethods, RefreshClaims, decode_token},
1919
},
2020
state::SharedState,
2121
},

src/api/handlers/account_handlers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
use axum::{
2+
Json,
23
extract::{Path, State},
34
http::StatusCode,
45
response::IntoResponse,
5-
Json,
66
};
77
use sqlx::types::Uuid;
88

99
use crate::{
1010
api::{
11-
version::{self, APIVersion},
1211
APIError,
12+
version::{self, APIVersion},
1313
},
1414
application::{
1515
repository::account_repo,

src/api/handlers/auth_handlers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
use axum::{extract::State, http::StatusCode, response::IntoResponse, Json};
1+
use axum::{Json, extract::State, http::StatusCode, response::IntoResponse};
22
use serde::{Deserialize, Serialize};
33
use serde_json::json;
44
use sqlx::types::Uuid;
55

66
use crate::{
7-
api::{version::APIVersion, APIError, APIErrorCode, APIErrorEntry, APIErrorKind},
7+
api::{APIError, APIErrorCode, APIErrorEntry, APIErrorKind, version::APIVersion},
88
application::{
99
repository::user_repo,
1010
security::{

src/api/handlers/transaction_handlers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
use axum::{
2+
Json,
23
extract::{Path, State},
34
http::StatusCode,
4-
Json,
55
};
66
use serde::{Deserialize, Serialize};
77
use sqlx::types::Uuid;
88
use thiserror::Error;
99

1010
use crate::{
1111
api::{
12-
version::{self, APIVersion},
1312
APIError, APIErrorCode, APIErrorEntry, APIErrorKind,
13+
version::{self, APIVersion},
1414
},
1515
application::{
1616
repository::transaction_repo,

0 commit comments

Comments
 (0)