Skip to content

Commit 8d60a50

Browse files
authored
Update Rust edition to 2024. (#55)
Now that the MSRV is 1.85 we can upgrade to the 2024 edition. All the code changes in this PR are the result of `cargo fmt --all`.
1 parent 0a5c0ff commit 8d60a50

11 files changed

Lines changed: 22 additions & 18 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ members = ["kompari", "kompari-cli", "kompari-html", "kompari-tasks"]
44

55
[workspace.package]
66
version = "0.1.0"
7-
edition = "2021"
7+
edition = "2024"
88
# Keep in sync with RUST_MIN_VER in .github/workflows/ci.yml, with the relevant README.md files,
99
# and with the MSRV in the Unreleased section of CHANGELOG.md.
1010
rust-version = "1.85"

kompari-cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
use clap::Parser;
1616
use kompari::DirDiffConfig;
17-
use kompari_html::{render_html_report, start_review_server, ReportConfig};
17+
use kompari_html::{ReportConfig, render_html_report, start_review_server};
1818
use kompari_tasks::check_size_optimizations;
1919
use std::path::PathBuf;
2020

kompari-html/src/report.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Copyright 2024 the Kompari Authors
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

4-
use crate::pageconsts::{CSS_STYLE, ICON, JS_CODE};
54
use crate::ReportConfig;
5+
use crate::pageconsts::{CSS_STYLE, ICON, JS_CODE};
66
use base64::prelude::*;
77
use chrono::SubsecRound;
88
use kompari::color::Rgba8;
99
use kompari::{ImageDifference, LeftRightError, PairResult};
10-
use maud::{html, Markup, PreEscaped, DOCTYPE};
10+
use maud::{DOCTYPE, Markup, PreEscaped, html};
1111
use rayon::iter::IndexedParallelIterator;
1212
use rayon::iter::IntoParallelRefIterator;
1313
use rayon::iter::ParallelIterator;

kompari-html/src/review.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Copyright 2025 the Kompari Authors
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

4-
use crate::{render_html_report, ReportConfig};
4+
use crate::{ReportConfig, render_html_report};
55
use axum::extract::State;
66
use axum::http::StatusCode;
77
use axum::response::{Html, IntoResponse};
88
use axum::routing::post;
9-
use axum::{routing::get, Json, Router};
10-
use kompari::{bless_image, DirDiffConfig};
9+
use axum::{Json, Router, routing::get};
10+
use kompari::{DirDiffConfig, bless_image};
1111
use serde::Deserialize;
1212
use std::path::PathBuf;
1313
use std::sync::Arc;

kompari-tasks/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ mod optimizations;
1717
mod task;
1818

1919
pub use args::Args;
20-
pub use optimizations::{check_size_optimizations, OptimizationResult};
20+
pub use optimizations::{OptimizationResult, check_size_optimizations};
2121
pub use task::{Actions, Task};

kompari-tasks/src/optimizations.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

44
use crate::args::SizeCheckArgs;
5-
use humansize::{format_size, DECIMAL};
6-
use kompari::{list_image_dir, optimize_png, SizeOptimizationLevel};
5+
use humansize::{DECIMAL, format_size};
6+
use kompari::{SizeOptimizationLevel, list_image_dir, optimize_png};
77
use rayon::iter::{IntoParallelIterator, ParallelIterator};
88
use std::cmp::min;
99
use std::io::Write;

kompari-tasks/src/task.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
use crate::args::{Args, Command, DeadSnapshotArgs};
55
use crate::check_size_optimizations;
6-
use kompari::{list_image_dir, list_image_dir_names, DirDiffConfig};
7-
use kompari_html::{render_html_report, start_review_server, ReportConfig};
6+
use kompari::{DirDiffConfig, list_image_dir, list_image_dir_names};
7+
use kompari_html::{ReportConfig, render_html_report, start_review_server};
88
use std::collections::BTreeSet;
99
use std::ops::Deref;
1010
use std::path::{Path, PathBuf};

kompari/src/dirdiff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2025 the Kompari Authors
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

4-
use crate::imgdiff::{compare_images, ImageDifference};
4+
use crate::imgdiff::{ImageDifference, compare_images};
55
use crate::{list_image_dir_names, load_image};
66
use rayon::iter::IntoParallelIterator;
77
use rayon::iter::ParallelIterator;

kompari/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ pub type Result<T> = std::result::Result<T, Error>;
6262

6363
pub use dirdiff::{DirDiff, DirDiffConfig, LeftRightError, PairResult};
6464
pub use fsutils::{list_image_dir, list_image_dir_names};
65-
pub use imageutils::{bless_image, image_to_png, load_image, optimize_png, SizeOptimizationLevel};
66-
pub use imgdiff::{compare_images, DiffImage, DiffImageMethod, ImageDifference};
65+
pub use imageutils::{SizeOptimizationLevel, bless_image, image_to_png, load_image, optimize_png};
66+
pub use imgdiff::{DiffImage, DiffImageMethod, ImageDifference, compare_images};

kompari/src/minimal_image.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ impl MinImage {
7272
let mut reader = decoder.read_info()?;
7373
let (width, height) = reader.info().size();
7474
let (color_type, png::BitDepth::Eight) = reader.output_color_type() else {
75-
unreachable!("Images get normalized to 8-bit grayscale or color, so `png::BitDepth::Eight` should always match");
75+
unreachable!(
76+
"Images get normalized to 8-bit grayscale or color, so `png::BitDepth::Eight` should always match"
77+
);
7678
};
7779
match color_type {
7880
png::ColorType::Rgba => {
@@ -119,7 +121,9 @@ impl MinImage {
119121
// - `Rgb` -> `Rgba`
120122
// - `Grayscale` -> `GrayscaleAlpha`
121123
// - `Indexed`-> `Rgba`
122-
_ => unreachable!("Images get normalized to 8-bit grayscale or color, so the above two arms match all possible cases."),
124+
_ => unreachable!(
125+
"Images get normalized to 8-bit grayscale or color, so the above two arms match all possible cases."
126+
),
123127
}
124128
}
125129
}

0 commit comments

Comments
 (0)