Skip to content

Commit

Permalink
chore: switch to Rust 2024 edition
Browse files Browse the repository at this point in the history
  • Loading branch information
eatradish committed Feb 21, 2025
1 parent 6f2a60f commit c2eae8e
Show file tree
Hide file tree
Showing 18 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "oma"
version = "1.15.0-alpha.0"
edition = "2021"
edition = "2024"
description = "User-friendly and performant package manager for APT repositories"
license = "GPL-3.0-or-later"
authors = ["eatradish <[email protected]>"]
Expand Down
2 changes: 1 addition & 1 deletion apt-auth-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "apt-auth-config"
version = "0.3.0"
edition = "2021"
edition = "2024"
description = "Library to parse APT auth.conf.d configurations"
license = "MIT"

Expand Down
2 changes: 1 addition & 1 deletion oma-console/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "oma-console"
version = "0.26.0"
edition = "2021"
edition = "2024"
description = "Console and terminal emulator handling library used by oma"
license = "MIT"

Expand Down
2 changes: 1 addition & 1 deletion oma-contents/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "oma-contents"
version = "0.16.0"
edition = "2021"
edition = "2024"
description = "APT Contents metadata handling library"
license = "MIT"

Expand Down
2 changes: 1 addition & 1 deletion oma-fetch/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "oma-fetch"
version = "0.25.0"
edition = "2021"
edition = "2024"
description = "APT repository download routines library"
license = "MIT"

Expand Down
2 changes: 1 addition & 1 deletion oma-history/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "oma-history"
version = "0.5.0"
edition = "2021"
edition = "2024"
description = "Package manager operations history database management library"
license = "MIT"

Expand Down
2 changes: 1 addition & 1 deletion oma-mirror/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "oma-mirror"
version = "0.3.0"
edition = "2021"
edition = "2024"
description = "Library to handle AOSC OS APT configuration (sources.list)"
license = "MIT"

Expand Down
2 changes: 1 addition & 1 deletion oma-pm-operation-type/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "oma-pm-operation-type"
version = "0.8.0"
edition = "2021"
edition = "2024"
license = "MIT"
description = "APT package management operation abstraction library"

Expand Down
2 changes: 1 addition & 1 deletion oma-pm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "oma-pm"
version = "0.46.0"
edition = "2021"
edition = "2024"
description = "APT package manager API abstraction library"
license = "GPL-3.0-or-later"

Expand Down
2 changes: 1 addition & 1 deletion oma-pm/src/apt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ impl OmaApt {
}

if yes || force_yes {
std::env::set_var("DEBIAN_FRONTEND", "noninteractive");
unsafe { std::env::set_var("DEBIAN_FRONTEND", "noninteractive") };
}

let dir = config.get("Dir").unwrap_or("/".to_owned());
Expand Down
2 changes: 1 addition & 1 deletion oma-pm/src/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl OmaAptInstallProgress {
} = args;

if pm.no_interactive() {
std::env::set_var("DEBIAN_FRONTEND", "noninteractive");
unsafe { std::env::set_var("DEBIAN_FRONTEND", "noninteractive") };
}

if !pm.use_pty() {
Expand Down
2 changes: 1 addition & 1 deletion oma-refresh/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "oma-refresh"
version = "0.41.0"
edition = "2021"
edition = "2024"
description = "APT repository refresh handler library"
license = "GPL-3.0-or-later"

Expand Down
2 changes: 1 addition & 1 deletion oma-repo-verify/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "oma-repo-verify"
version = "0.5.1"
edition = "2021"
edition = "2024"
description = "Handle APT repository verify library"
license = "MIT"

Expand Down
2 changes: 1 addition & 1 deletion oma-topics/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "oma-topics"
version = "0.21.0"
edition = "2021"
edition = "2024"
description = "AOSC OS topic (testing) repository manager used by oma"
license = "MIT"

Expand Down
2 changes: 1 addition & 1 deletion oma-utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "oma-utils"
version = "0.10.5"
edition = "2021"
edition = "2024"
description = "General system API and utilities used by oma"
license = "MIT"

Expand Down
13 changes: 9 additions & 4 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ impl<'a> Iterator for Chain<'a> {

impl DoubleEndedIterator for Chain<'_> {
fn next_back(&mut self) -> Option<Self::Item> {
match &mut self.state {
Linked { mut next } => {
match &self.state {
Linked { next } => {
let mut next = next.to_owned();
let mut rest = Vec::new();
while let Some(cause) = next {
next = cause.source();
Expand All @@ -109,16 +110,20 @@ impl DoubleEndedIterator for Chain<'_> {
self.state = Buffered { rest };
last
}
Buffered { rest } => rest.next_back(),
Buffered { rest } => {
let mut rest = rest.to_owned();
rest.next_back()
}
}
}
}

impl ExactSizeIterator for Chain<'_> {
fn len(&self) -> usize {
match &self.state {
Linked { mut next } => {
Linked { next } => {
let mut len = 0;
let mut next = next.to_owned();
while let Some(cause) = next {
next = cause.source();
len += 1;
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ fn init_color_formatter(oma: &OhManagerAilurus, config: &Config) {
let no_color = oma.global.color == ColorChoice::Never;

if no_color {
env::set_var("NO_COLOR", "1");
unsafe { env::set_var("NO_COLOR", "1") };
}

COLOR_FORMATTER.get_or_init(|| {
Expand Down
2 changes: 1 addition & 1 deletion src/tui/tui_inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl Display for Operation {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Operation::Package { name, version } => {
if let Some(ref ver) = version {
if let Some(ver) = version {
writeln!(f, "+ {} ({})", name, ver)?;
} else {
writeln!(f, "- {}", name)?;
Expand Down

0 comments on commit c2eae8e

Please sign in to comment.