Skip to content

Commit 30ebac1

Browse files
authored
Bump Rust to 1.86 (#220)
Signed-off-by: Sergio Castaño Arteaga <[email protected]>
1 parent 606fe52 commit 30ebac1

File tree

8 files changed

+20
-13
lines changed

8 files changed

+20
-13
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup Rust
1616
uses: dtolnay/rust-toolchain@master
1717
with:
18-
toolchain: 1.85.0
18+
toolchain: 1.86.0
1919
components: clippy, rustfmt
2020
- name: Install Tailwind CSS
2121
run: |

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ members = [
88
version = "0.0.1"
99
license = "Apache-2.0"
1010
edition = "2024"
11-
rust-version = "1.85"
11+
rust-version = "1.86"
1212

1313
[workspace.dependencies]
1414
anyhow = "1.0.97"

gitjobs-server/src/db/img.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! This module defines some database functionality used to manage images.
22
3+
use std::sync::Arc;
4+
35
use anyhow::Result;
46
use async_trait::async_trait;
57
use tracing::{instrument, trace};
@@ -24,6 +26,9 @@ pub(crate) trait DBImage {
2426
async fn save_image_versions(&self, user_id: &Uuid, versions: Vec<ImageVersion>) -> Result<Uuid>;
2527
}
2628

29+
/// Type alias to represent a `DBImage` trait object.
30+
pub(crate) type DynDBImage = Arc<dyn DBImage + Send + Sync>;
31+
2732
#[async_trait]
2833
impl DBImage for PgDB {
2934
#[instrument(skip(self), err)]

gitjobs-server/src/handlers/auth.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ fn get_log_in_url(next_url: Option<&String>) -> String {
461461
let mut log_in_url = LOG_IN_URL.to_string();
462462
if let Some(next_url) = next_url {
463463
log_in_url = format!("{log_in_url}?next_url={next_url}");
464-
};
464+
}
465465
log_in_url
466466
}
467467

gitjobs-server/src/img/db.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,18 @@ use async_trait::async_trait;
55
use uuid::Uuid;
66

77
use crate::{
8-
db::DynDB,
8+
db::img::DynDBImage,
99
img::{ImageFormat, ImageStore, ImageVersion, generate_versions, is_svg},
1010
};
1111

1212
/// Database-backed image store.
1313
pub(crate) struct DbImageStore {
14-
// TODO: switch to DynDBImage when 1.86 is released
15-
// https://github.com/rust-lang/rust/issues/65991
16-
db: DynDB,
14+
db: DynDBImage,
1715
}
1816

1917
impl DbImageStore {
2018
/// Create a new `DbImageStore` instance.
21-
pub(crate) fn new(db: DynDB) -> Self {
19+
pub(crate) fn new(db: DynDBImage) -> Self {
2220
Self { db }
2321
}
2422
}

gitjobs-server/src/img/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub(crate) enum ImageFormat {
6464

6565
/// Check if the image is in SVG format.
6666
pub(crate) fn is_svg(file_name: &str) -> bool {
67-
if let Some(extension) = file_name.split('.').last() {
67+
if let Some(extension) = file_name.split('.').next_back() {
6868
if extension.to_lowercase() == "svg" {
6969
return true;
7070
}

gitjobs-server/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async fn main() -> Result<()> {
5858
match cfg.log.format {
5959
LogFormat::Json => ts.json().init(),
6060
LogFormat::Pretty => ts.init(),
61-
};
61+
}
6262

6363
// Setup task tracker and cancellation token
6464
let tracker = TaskTracker::new();

gitjobs-server/src/templates/pagination.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! This module defines some types and functionality used to paginate.
22
3+
use std::fmt::Write as _;
4+
35
use anyhow::Result;
46
use askama::Template;
57
use serde::{Deserialize, Serialize};
@@ -142,12 +144,14 @@ pub(crate) fn build_url<T>(base_url: &str, filters: &T) -> Result<String>
142144
where
143145
T: Serialize + Pagination,
144146
{
145-
let mut url = base_url.to_string();
146-
let sep = get_url_filters_separator(&url);
147+
let sep = get_url_filters_separator(base_url);
147148
let filters_params = serde_qs::to_string(filters)?;
149+
150+
let mut url = base_url.to_string();
148151
if !filters_params.is_empty() {
149-
url.push_str(&format!("{sep}{filters_params}"));
152+
write!(url, "{sep}{filters_params}")?;
150153
}
154+
151155
Ok(url)
152156
}
153157

0 commit comments

Comments
 (0)