Skip to content

Commit f3fed89

Browse files
committed
chore: switch to Rust 2024 edition
1 parent abe46a8 commit f3fed89

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+183
-183
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "oma"
33
version = "1.15.0-alpha.0"
4-
edition = "2021"
4+
edition = "2024"
55
description = "User-friendly and performant package manager for APT repositories"
66
license = "GPL-3.0-or-later"
77
authors = ["eatradish <sakiiily@aosc.io>"]

apt-auth-config/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "apt-auth-config"
33
version = "0.3.0"
4-
edition = "2021"
4+
edition = "2024"
55
description = "Library to parse APT auth.conf.d configurations"
66
license = "MIT"
77

oma-console/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "oma-console"
33
version = "0.26.0"
4-
edition = "2021"
4+
edition = "2024"
55
description = "Console and terminal emulator handling library used by oma"
66
license = "MIT"
77

oma-console/src/pager.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::{
2-
io::{self, stderr, stdin, stdout, BufRead, ErrorKind, IsTerminal, Write},
2+
io::{self, BufRead, ErrorKind, IsTerminal, Write, stderr, stdin, stdout},
33
time::{Duration, Instant},
44
};
55

@@ -8,16 +8,16 @@ use ansi_to_tui::IntoText;
88
use crossterm::{
99
event::{self, Event, KeyCode, KeyModifiers},
1010
execute,
11-
terminal::{enable_raw_mode, EnterAlternateScreen},
11+
terminal::{EnterAlternateScreen, enable_raw_mode},
1212
};
1313
use ratatui::{
14+
Frame, Terminal,
1415
backend::{Backend, CrosstermBackend},
1516
layout::{Alignment, Constraint, Layout},
1617
restore,
1718
style::{Color, Stylize},
1819
text::Text,
1920
widgets::{Block, Paragraph, Scrollbar, ScrollbarOrientation, ScrollbarState},
20-
Frame, Terminal,
2121
};
2222
use termbg::Theme;
2323
use tracing::debug;

oma-console/src/print.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::{borrow::Cow, collections::BTreeMap, time::Duration};
22

3-
use console::{style, Color, StyledObject};
3+
use console::{Color, StyledObject, style};
44
use termbg::Theme;
5-
use tracing::{debug, field::Field, Level};
5+
use tracing::{Level, debug, field::Field};
66
use tracing_subscriber::Layer;
77

88
pub use termbg;

oma-console/src/writer.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,7 @@ impl Writer {
9292
let len = self.get_length();
9393

9494
if let Some(limit) = self.limit_max_len {
95-
if len < limit {
96-
len
97-
} else {
98-
limit
99-
}
95+
if len < limit { len } else { limit }
10096
} else {
10197
len
10298
}

oma-contents/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "oma-contents"
33
version = "0.16.0"
4-
edition = "2021"
4+
edition = "2024"
55
description = "APT Contents metadata handling library"
66
license = "MIT"
77

oma-contents/examples/list_files.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use oma_contents::searcher::{pure_search, Mode};
1+
use oma_contents::searcher::{Mode, pure_search};
22

33
fn main() {
44
pure_search("/var/lib/apt/lists", Mode::Files, "apt", |(pkg, file)| {

oma-contents/examples/list_files_rg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use oma_contents::searcher::{ripgrep_search, Mode};
1+
use oma_contents::searcher::{Mode, ripgrep_search};
22

33
fn main() {
44
ripgrep_search("/var/lib/apt/lists", Mode::Files, "apt", |(pkg, file)| {

oma-contents/src/parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use winnow::{combinator::separated, token::take_till, ModalResult, Parser};
1+
use winnow::{ModalResult, Parser, combinator::separated, token::take_till};
22

33
use crate::OmaContentsError;
44

oma-contents/src/searcher.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use std::{
44
path::{Path, PathBuf},
55
process::{Command, Stdio},
66
sync::{
7-
mpsc::{self, Sender},
87
Arc,
8+
mpsc::{self, Sender},
99
},
1010
thread,
1111
};
@@ -17,7 +17,7 @@ use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
1717
use tracing::debug;
1818
use zstd::Decoder;
1919

20-
use crate::{parser::parse_contents_single_line, OmaContentsError};
20+
use crate::{OmaContentsError, parser::parse_contents_single_line};
2121

2222
const ZSTD_MAGIC: &[u8] = &[40, 181, 47, 253];
2323
const LZ4_MAGIC: &[u8] = &[0x04, 0x22, 0x4d, 0x18];

oma-fetch/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "oma-fetch"
33
version = "0.25.0"
4-
edition = "2021"
4+
edition = "2024"
55
description = "APT repository download routines library"
66
license = "MIT"
77

oma-fetch/examples/downloads.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::path::PathBuf;
22

33
use oma_fetch::{
4-
checksum::Checksum, DownloadEntry, DownloadManager, DownloadSource, DownloadSourceType, Event,
4+
DownloadEntry, DownloadManager, DownloadSource, DownloadSourceType, Event, checksum::Checksum,
55
};
66
use reqwest::ClientBuilder;
77

oma-fetch/src/download.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ use std::{
1010

1111
use async_compression::futures::bufread::{BzDecoder, GzipDecoder, XzDecoder, ZstdDecoder};
1212
use bon::Builder;
13-
use futures::{io::BufReader, AsyncRead, TryStreamExt};
13+
use futures::{AsyncRead, TryStreamExt, io::BufReader};
1414
use oma_utils::url_no_escape::url_no_escape;
1515
use reqwest::{
16-
header::{HeaderValue, ACCEPT_RANGES, CONTENT_LENGTH, RANGE},
1716
Client, Method, RequestBuilder,
17+
header::{ACCEPT_RANGES, CONTENT_LENGTH, HeaderValue, RANGE},
1818
};
1919
use snafu::{ResultExt, Snafu};
2020
use tokio::{

oma-fetch/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{cmp::Ordering, path::PathBuf, time::Duration};
22

3-
use bon::{builder, Builder};
3+
use bon::{Builder, builder};
44
use checksum::Checksum;
55
use download::{EmptySource, SingleDownloader, SuccessSummary};
66
use futures::{Future, StreamExt};

oma-history/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "oma-history"
33
version = "0.5.0"
4-
edition = "2021"
4+
edition = "2024"
55
description = "Package manager operations history database management library"
66
license = "MIT"
77

oma-history/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub fn connect_db<P: AsRef<Path>>(db_path: P, write: bool) -> HistoryResult<Conn
6060
Ok(conn) => conn,
6161
Err(e) => match e {
6262
Error::SqliteFailure(err, _) if [1, 14].contains(&err.extended_code) => {
63-
return Err(HistoryError::HistoryEmpty)
63+
return Err(HistoryError::HistoryEmpty);
6464
}
6565
e => return Err(HistoryError::ConnectError(e)),
6666
},
@@ -304,7 +304,7 @@ pub fn list_history(conn: &Connection) -> HistoryResult<Vec<HistoryEntry>> {
304304
Ok(stmt) => stmt,
305305
Err(e) => match e {
306306
Error::SqliteFailure(err, _) if [1, 14].contains(&err.extended_code) => {
307-
return Err(HistoryError::HistoryEmpty)
307+
return Err(HistoryError::HistoryEmpty);
308308
}
309309
e => return Err(HistoryError::ConnectError(e)),
310310
},

oma-history/src/migrations.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use serde_json::Value;
55
use tracing::{debug, info, warn};
66

77
use crate::{
8-
HistoryEntryInner, HistoryError, HistoryResult, InstallHistoryEntry, RemoveHistoryEntry,
9-
INSERT_INSTALL_TABLE, INSERT_NEW_MAIN_TABLE, INSERT_REMOVE_DETAIL_TABLE, INSERT_REMOVE_TABLE,
8+
HistoryEntryInner, HistoryError, HistoryResult, INSERT_INSTALL_TABLE, INSERT_NEW_MAIN_TABLE,
9+
INSERT_REMOVE_DETAIL_TABLE, INSERT_REMOVE_TABLE, InstallHistoryEntry, RemoveHistoryEntry,
1010
};
1111

1212
pub fn create_and_maybe_migration_from_oma_db_v2(conn: &Connection) -> HistoryResult<()> {
@@ -243,7 +243,9 @@ fn get_old_table(conn: &Connection) -> Result<Vec<OldTableEntry>, HistoryError>
243243
) {
244244
Ok(i) => i,
245245
Err(e) => {
246-
warn!("Unable to migrate a history database entry from unix timestamp {time}: {e}, skipping ...", );
246+
warn!(
247+
"Unable to migrate a history database entry from unix timestamp {time}: {e}, skipping ...",
248+
);
247249
debug!("install packages: {}", install_packages);
248250
has_fail = true;
249251
continue;
@@ -277,11 +279,15 @@ fn get_old_table(conn: &Connection) -> Result<Vec<OldTableEntry>, HistoryError>
277279
if !res.is_empty() {
278280
res
279281
} else if is_clean_configure {
280-
warn!("`oma purge' entries from the old history database cannot be migrated from unix timestamp {time}, skipping ...");
282+
warn!(
283+
"`oma purge' entries from the old history database cannot be migrated from unix timestamp {time}, skipping ..."
284+
);
281285
debug!("remove packages: {}", &remove_packages);
282286
continue;
283287
} else {
284-
warn!("Unable to migrate a history database entry from unix timestamp {time}: {e}, skipping ...");
288+
warn!(
289+
"Unable to migrate a history database entry from unix timestamp {time}: {e}, skipping ..."
290+
);
285291
debug!("remove packages: {}", &remove_packages);
286292
has_fail = true;
287293
continue;
@@ -292,7 +298,9 @@ fn get_old_table(conn: &Connection) -> Result<Vec<OldTableEntry>, HistoryError>
292298
let summary_type = match serde_json::from_str::<OldSummaryType>(&summary_type) {
293299
Ok(s) => s,
294300
Err(e) => {
295-
warn!("Unable to migrate a history database entry from unix timestamp {time}: {e}, skipping ...", );
301+
warn!(
302+
"Unable to migrate a history database entry from unix timestamp {time}: {e}, skipping ...",
303+
);
296304
debug!("summary type: {}", &summary_type);
297305
has_fail = true;
298306
continue;

oma-mirror/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "oma-mirror"
33
version = "0.3.0"
4-
edition = "2021"
4+
edition = "2024"
55
description = "Library to handle AOSC OS APT configuration (sources.list)"
66
license = "MIT"
77

oma-mirror/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::{
55
};
66

77
use ahash::HashMap;
8-
use indexmap::{indexmap, IndexMap};
8+
use indexmap::{IndexMap, indexmap};
99
use once_cell::sync::OnceCell;
1010
use serde::{Deserialize, Serialize};
1111
use snafu::{ResultExt, Snafu};

oma-pm-operation-type/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "oma-pm-operation-type"
33
version = "0.8.0"
4-
edition = "2021"
4+
edition = "2024"
55
license = "MIT"
66
description = "APT package management operation abstraction library"
77

oma-pm-operation-type/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::fmt::Display;
22

3-
use bon::{builder, Builder};
3+
use bon::{Builder, builder};
44
use num_enum::{FromPrimitive, IntoPrimitive};
55
use oma_utils::human_bytes::HumanBytes;
66
use serde::{Deserialize, Serialize};

oma-pm/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "oma-pm"
33
version = "0.47.0"
4-
edition = "2021"
4+
edition = "2024"
55
description = "APT package manager API abstraction library"
66
license = "GPL-3.0-or-later"
77

oma-pm/examples/download_pkgs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::{path::Path, thread};
22

33
use apt_auth_config::AuthConfig;
44
use flume::unbounded;
5-
use oma_fetch::{reqwest::ClientBuilder, Event};
5+
use oma_fetch::{Event, reqwest::ClientBuilder};
66
use oma_pm::{
77
apt::{AptConfig, DownloadConfig, OmaApt, OmaAptArgs, OmaAptError},
88
matches::PackagesMatcher,

oma-pm/examples/install_fish.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ use std::{io::Write, thread};
33
use apt_auth_config::AuthConfig;
44
use flume::unbounded;
55
use oma_apt::util::{get_apt_progress_string, terminal_height, terminal_width};
6-
use oma_fetch::{reqwest::ClientBuilder, Event};
6+
use oma_fetch::{Event, reqwest::ClientBuilder};
77
use oma_pm::{
8+
CommitNetworkConfig,
89
apt::{AptConfig, OmaApt, OmaAptArgs, OmaAptError, SummarySort},
910
matches::PackagesMatcher,
1011
progress::InstallProgressManager,
11-
CommitNetworkConfig,
1212
};
1313

1414
struct MyInstallProgressManager;

oma-pm/src/apt.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@ use std::{
88

99
use ahash::HashSet;
1010
use apt_auth_config::AuthConfig;
11-
use bon::{builder, Builder};
11+
use bon::{Builder, builder};
1212
pub use oma_apt::cache::Upgrade;
1313
use std::future::Future;
1414
use tokio::runtime::Runtime;
1515
use zbus::Connection;
1616

1717
use oma_apt::{
18+
DepFlags, Dependency, Package, PkgCurrentState, Version,
1819
cache::{Cache, PackageSort},
1920
error::{AptError, AptErrors},
2021
new_cache,
2122
progress::{AcquireProgress, InstallProgress},
2223
raw::IntoRawIter,
2324
records::RecordField,
2425
util::DiskSpace,
25-
DepFlags, Dependency, Package, PkgCurrentState, Version,
2626
};
2727

28-
use oma_fetch::{checksum::ChecksumError, reqwest::Client, Event, Summary};
28+
use oma_fetch::{Event, Summary, checksum::ChecksumError, reqwest::Client};
2929
use oma_utils::{
30-
dpkg::{get_selections, is_hold, DpkgError},
30+
dpkg::{DpkgError, get_selections, is_hold},
3131
human_bytes::HumanBytes,
3232
};
3333

@@ -330,7 +330,7 @@ impl OmaApt {
330330
}
331331

332332
if yes || force_yes {
333-
std::env::set_var("DEBIAN_FRONTEND", "noninteractive");
333+
unsafe { std::env::set_var("DEBIAN_FRONTEND", "noninteractive") };
334334
}
335335

336336
let dir = config.get("Dir").unwrap_or("/".to_owned());

oma-pm/src/commit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use oma_apt::{
66
progress::{AcquireProgress, InstallProgress},
77
util::{apt_lock, apt_lock_inner, apt_unlock, apt_unlock_inner},
88
};
9-
use oma_fetch::{reqwest::Client, Event, Summary};
9+
use oma_fetch::{Event, Summary, reqwest::Client};
1010
use oma_pm_operation_type::{InstallEntry, OmaOperation};
1111
use std::io::Write;
1212
use tracing::debug;

oma-pm/src/dbus.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use zbus::{interface, proxy, Connection, Result};
1+
use zbus::{Connection, Result, interface, proxy};
22

33
pub struct OmaBus {
44
pub status: Status,

oma-pm/src/download.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use std::{borrow::Cow, future::Future, path::Path};
22

33
use oma_console::console;
44
use oma_fetch::{
5-
checksum::Checksum, reqwest::Client, DownloadEntry, DownloadManager, DownloadSource,
6-
DownloadSourceType, Event, Summary,
5+
DownloadEntry, DownloadManager, DownloadSource, DownloadSourceType, Event, Summary,
6+
checksum::Checksum, reqwest::Client,
77
};
88
use oma_pm_operation_type::InstallEntry;
99
use tracing::debug;

oma-pm/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ pub mod matches;
3434
pub mod pkginfo;
3535
pub mod progress;
3636
pub mod search;
37-
pub use oma_apt::error::AptErrors;
3837
pub use oma_apt::PkgCurrentState;
38+
pub use oma_apt::error::AptErrors;
3939
pub use search::PackageStatus;
4040
mod commit;
4141
mod dbus;

0 commit comments

Comments
 (0)