Skip to content

Commit 4445f06

Browse files
authored
chore(project): migrate to Rust 2024 edition (#1128)
1 parent 4a3c0c0 commit 4445f06

14 files changed

Lines changed: 73 additions & 69 deletions

File tree

‎Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# syntax=docker/dockerfile:1.4.3-labs
2-
FROM lukemathwalker/cargo-chef:0.1.70-rust-1.84.0-slim AS chef
2+
FROM lukemathwalker/cargo-chef:0.1.71-rust-1.85.0-slim-bookworm AS chef
33
WORKDIR app
44

55
FROM chef AS planner

‎flake.lock‎

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

‎git-cliff-core/Cargo.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ readme = "../README.md"
88
homepage = "https://github.com/orhun/git-cliff"
99
repository = "https://github.com/orhun/git-cliff"
1010
keywords = ["changelog", "generator", "conventional", "commit"]
11-
edition = "2021"
12-
rust-version = "1.83.0"
11+
edition = "2024"
12+
rust-version = "1.85.0"
1313

1414
[features]
1515
default = ["repo"]

‎git-cliff-core/src/commit.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ use crate::error::{
88
Error as AppError,
99
Result,
1010
};
11+
use git_conventional::{
12+
Commit as ConventionalCommit,
13+
Footer as ConventionalFooter,
14+
};
1115
#[cfg(feature = "repo")]
1216
use git2::{
1317
Commit as GitCommit,
1418
Signature as CommitSignature,
1519
};
16-
use git_conventional::{
17-
Commit as ConventionalCommit,
18-
Footer as ConventionalFooter,
19-
};
2020
use lazy_regex::{
21-
lazy_regex,
2221
Lazy,
2322
Regex,
23+
lazy_regex,
2424
};
2525
use serde::ser::{
2626
SerializeStruct,

‎git-cliff-core/src/config.rs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,11 @@ mod test {
490490
const TAG_PATTERN_VALUE: &str = ".*[0-9].*";
491491
const IGNORE_TAGS_VALUE: &str = "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+";
492492

493-
env::set_var("GIT_CLIFF__CHANGELOG__FOOTER", FOOTER_VALUE);
494-
env::set_var("GIT_CLIFF__GIT__TAG_PATTERN", TAG_PATTERN_VALUE);
495-
env::set_var("GIT_CLIFF__GIT__IGNORE_TAGS", IGNORE_TAGS_VALUE);
493+
unsafe {
494+
env::set_var("GIT_CLIFF__CHANGELOG__FOOTER", FOOTER_VALUE);
495+
env::set_var("GIT_CLIFF__GIT__TAG_PATTERN", TAG_PATTERN_VALUE);
496+
env::set_var("GIT_CLIFF__GIT__IGNORE_TAGS", IGNORE_TAGS_VALUE);
497+
};
496498

497499
let config = Config::parse(&path)?;
498500

‎git-cliff-core/src/remote/mod.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ use crate::error::{
2222
};
2323
use dyn_clone::DynClone;
2424
use futures::{
25+
StreamExt,
2526
future,
2627
stream,
27-
StreamExt,
2828
};
2929
use http_cache_reqwest::{
3030
CACacheManager,
@@ -33,11 +33,11 @@ use http_cache_reqwest::{
3333
HttpCache,
3434
HttpCacheOptions,
3535
};
36+
use reqwest::Client;
3637
use reqwest::header::{
3738
HeaderMap,
3839
HeaderValue,
3940
};
40-
use reqwest::Client;
4141
use reqwest_middleware::{
4242
ClientBuilder,
4343
ClientWithMiddleware,
@@ -52,8 +52,8 @@ use std::env;
5252
use std::fmt::Debug;
5353
use std::time::Duration;
5454
use time::{
55-
format_description::well_known::Rfc3339,
5655
OffsetDateTime,
56+
format_description::well_known::Rfc3339,
5757
};
5858

5959
/// User agent for interacting with the GitHub API.

‎git-cliff-core/src/repo.rs‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ use git2::{
1717
use glob::Pattern;
1818
use indexmap::IndexMap;
1919
use lazy_regex::{
20-
lazy_regex,
2120
Lazy,
2221
Regex,
22+
lazy_regex,
2323
};
2424
use std::io;
2525
use std::path::{
@@ -238,12 +238,11 @@ impl Repository {
238238
.expect("failed to add '**' to the end of glob"),
239239
_ => pattern,
240240
};
241-
let pattern_normal = match star_added.as_str().strip_prefix("./") {
241+
match star_added.as_str().strip_prefix("./") {
242242
Some(stripped) => Pattern::new(stripped)
243243
.expect("failed to remove leading ./ from glob"),
244244
None => star_added,
245-
};
246-
pattern_normal
245+
}
247246
}
248247

249248
/// Calculates whether the commit should be retained or not.
@@ -710,9 +709,11 @@ mod test {
710709
#[test]
711710
fn commit_search() -> Result<()> {
712711
let repository = get_repository()?;
713-
assert!(repository
714-
.find_commit("e936ed571533ea6c41a1dd2b1a29d085c8dbada5")
715-
.is_some());
712+
assert!(
713+
repository
714+
.find_commit("e936ed571533ea6c41a1dd2b1a29d085c8dbada5")
715+
.is_some()
716+
);
716717
Ok(())
717718
}
718719

@@ -912,10 +913,12 @@ mod test {
912913

913914
assert!(result.is_err());
914915
if let Err(error) = result {
915-
assert!(format!("{error:?}").contains(
916-
format!("could not find repository at '{}'", path.display())
917-
.as_str()
918-
))
916+
assert!(
917+
format!("{error:?}").contains(
918+
format!("could not find repository at '{}'", path.display())
919+
.as_str()
920+
)
921+
)
919922
}
920923
}
921924

@@ -945,13 +948,10 @@ mod test {
945948
.expect("failed to execute git commit");
946949
assert!(output.status.success(), "git commit failed {:?}", output);
947950

948-
let last_commit = repo
949-
.inner
951+
repo.inner
950952
.head()
951953
.and_then(|head| head.peel_to_commit())
952-
.expect("failed to get the last commit");
953-
954-
last_commit
954+
.expect("failed to get the last commit")
955955
}
956956

957957
#[test]

‎git-cliff-core/src/template.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ use std::collections::{
1212
};
1313
use std::error::Error as ErrorImpl;
1414
use tera::{
15-
ast,
1615
Context as TeraContext,
1716
Result as TeraResult,
1817
Tera,
1918
Value,
19+
ast,
2020
};
2121

2222
/// Wrapper for [`Tera`].

‎git-cliff/Cargo.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ repository = "https://github.com/orhun/git-cliff"
1010
keywords = ["changelog", "generator", "conventional", "commit"]
1111
categories = ["command-line-utilities"]
1212
default-run = "git-cliff"
13-
edition = "2021"
14-
rust-version = "1.83.0"
13+
edition = "2024"
14+
rust-version = "1.85.0"
1515

1616
[[bin]]
1717
name = "git-cliff-completions"

‎git-cliff/src/args.rs‎

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
use clap::{
2+
ArgAction,
3+
Parser,
4+
ValueEnum,
25
builder::{
6+
Styles,
7+
TypedValueParser,
8+
ValueParserFactory,
39
styling::{
410
Ansi256Color,
511
AnsiColor,
612
},
7-
Styles,
8-
TypedValueParser,
9-
ValueParserFactory,
1013
},
1114
error::{
1215
ContextKind,
1316
ContextValue,
1417
ErrorKind,
1518
},
16-
ArgAction,
17-
Parser,
18-
ValueEnum,
1919
};
2020
use git_cliff_core::{
21-
config::BumpType,
22-
config::Remote,
2321
DEFAULT_CONFIG,
2422
DEFAULT_OUTPUT,
23+
config::BumpType,
24+
config::Remote,
2525
};
2626
use glob::Pattern;
2727
use regex::Regex;
@@ -512,12 +512,16 @@ mod tests {
512512
OsStr::new("https://gitlab.archlinux.org/archlinux/packaging/packages/arch-repro-status")
513513
)?
514514
);
515-
assert!(remote_value_parser
516-
.parse_ref(&Opt::command(), None, OsStr::new("test"))
517-
.is_err());
518-
assert!(remote_value_parser
519-
.parse_ref(&Opt::command(), None, OsStr::new(""))
520-
.is_err());
515+
assert!(
516+
remote_value_parser
517+
.parse_ref(&Opt::command(), None, OsStr::new("test"))
518+
.is_err()
519+
);
520+
assert!(
521+
remote_value_parser
522+
.parse_ref(&Opt::command(), None, OsStr::new(""))
523+
.is_err()
524+
);
521525
Ok(())
522526
}
523527

@@ -532,9 +536,11 @@ mod tests {
532536
OsStr::new("auto")
533537
)?
534538
);
535-
assert!(bump_option_parser
536-
.parse_ref(&Opt::command(), None, OsStr::new("test"))
537-
.is_err());
539+
assert!(
540+
bump_option_parser
541+
.parse_ref(&Opt::command(), None, OsStr::new("test"))
542+
.is_err()
543+
);
538544
assert_eq!(
539545
BumpOption::Specific(BumpType::Major),
540546
bump_option_parser.parse_ref(

0 commit comments

Comments
 (0)