Skip to content

Commit 4b5463c

Browse files
committed
build: Update edition to Rust 2024
Signed-off-by: Daiki Ueno <[email protected]>
1 parent efa33c5 commit 4b5463c

File tree

19 files changed

+57
-60
lines changed

19 files changed

+57
-60
lines changed

.github/workflows/python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
python-version: ['3.7', '3.8', '3.9', '3.10']
15+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
1616

1717
steps:
1818
- uses: actions/checkout@v4

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
name: Fedora tests
2323
runs-on: ubuntu-latest
2424
container:
25-
image: registry.fedoraproject.org/fedora:40
25+
image: registry.fedoraproject.org/fedora:42
2626
options: --privileged
2727
steps:
2828
- uses: actions/checkout@v4

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ resolver = "2"
1111

1212
[workspace.package]
1313
version = "0.2.3"
14-
edition = "2021"
14+
edition = "2024"
1515
license = "GPL-3.0-or-later"
1616
authors = ["The crypto-auditing developers"]
1717

agent/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn main() {
3737
SkeletonBuilder::new()
3838
.source(&src)
3939
.clang_args([OsStr::new("-I"), builddir.as_os_str()])
40-
.build_and_generate(&builddir.join("audit.skel.rs"))
40+
.build_and_generate(builddir.join("audit.skel.rs"))
4141
.unwrap();
4242
println!("cargo:rerun-if-changed={}", src.display());
4343
}

agent/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// SPDX-License-Identifier: GPL-3.0-or-later
22
// Copyright (C) 2022-2023 The crypto-auditing developers.
33

4-
use anyhow::{anyhow, Context as _, Result};
5-
use clap::{arg, command, parser::ValueSource, value_parser, ArgAction, ArgMatches, ValueEnum};
4+
use anyhow::{Context as _, Result, anyhow};
5+
use clap::{ArgAction, ArgMatches, ValueEnum, arg, command, parser::ValueSource, value_parser};
66
use std::fs;
77
use std::path::{Path, PathBuf};
88
use std::str::FromStr;

agent/src/log_writer.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
// Copyright (C) 2022-2023 The crypto-auditing developers.
33

44
use crate::config;
5-
use anyhow::{bail, Context as _, Result};
5+
use anyhow::{Context as _, Result, bail};
66
use crypto_auditing::types::EventGroup;
77
use probe::probe;
8-
use serde_cbor::{ser::IoWrite, Serializer};
8+
use serde_cbor::{Serializer, ser::IoWrite};
99
use std::path::PathBuf;
10-
use time::{macros::format_description, OffsetDateTime};
10+
use time::{OffsetDateTime, macros::format_description};
1111
use tokio::time::{Duration, Instant};
1212
#[cfg(not(feature = "tokio-uring"))]
1313
use tokio::{
14-
fs::{rename, File},
14+
fs::{File, rename},
1515
io::AsyncWriteExt,
1616
};
1717
#[cfg(feature = "tokio-uring")]
18-
use tokio_uring::fs::{rename, File};
18+
use tokio_uring::fs::{File, rename};
1919

2020
pub struct LogWriter {
2121
config: config::Config,
@@ -125,7 +125,7 @@ impl LogWriter {
125125
let mut counter = 0u64;
126126
while backup_log_file.exists() {
127127
counter += 1;
128-
backup_log_file.set_extension(&counter.to_string());
128+
backup_log_file.set_extension(counter.to_string());
129129
}
130130

131131
rename(&self.config.log_file, &backup_log_file)

agent/src/main.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: GPL-3.0-or-later
22
// Copyright (C) 2022-2023 The crypto-auditing developers.
33

4-
use anyhow::{bail, Context as _, Result};
4+
use anyhow::{Context as _, Result, bail};
55
use bytes::BytesMut;
66
use core::future::Future;
77
use crypto_auditing::types::{ContextID, EventGroup};
@@ -14,9 +14,9 @@ use std::io::prelude::*;
1414
use std::mem::MaybeUninit;
1515
use std::path::Path;
1616
use tokio::io::AsyncReadExt;
17-
use tokio::time::{timeout, Duration};
17+
use tokio::time::{Duration, timeout};
1818
use tracing::{debug, info};
19-
use tracing_subscriber::{fmt, prelude::*, EnvFilter};
19+
use tracing_subscriber::{EnvFilter, fmt, prelude::*};
2020

2121
mod config;
2222
mod log_writer;
@@ -180,12 +180,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
180180

181181
// Successfully waited
182182
if let Ok(res) = res {
183-
if let Some(ref mut tracer) = tracer {
184-
if let Err(e) =
183+
if let Some(ref mut tracer) = tracer
184+
&& let Err(e) =
185185
tracer.write(&writer.elapsed(), &encryption_key, buffer.as_ref())
186-
{
187-
info!(error = %e, "error writing trace");
188-
}
186+
{
187+
info!(error = %e, "error writing trace");
189188
}
190189

191190
let n = res?;

agent/src/permissions.rs

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

4-
use anyhow::{anyhow, Result};
4+
use anyhow::{Result, anyhow};
55
use std::ffi::CString;
66
use std::io::Error;
77

agent/src/ringbuf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Licensed under LGPL-2.1 or BSD-2-Clause.
44

55
use core::task::{Context, Poll};
6-
use libbpf_rs::{query::MapInfoIter, Map, MapCore};
6+
use libbpf_rs::{Map, MapCore, query::MapInfoIter};
77
use std::io::Result;
88
use std::num::NonZeroUsize;
99
use std::os::fd::{AsFd, AsRawFd, RawFd};
@@ -69,7 +69,7 @@ impl RingBuffer {
6969
len <<= 2;
7070
len >>= 2;
7171
len += BPF_RINGBUF_HDR_SZ;
72-
(len + 7) / 8 * 8
72+
len.div_ceil(8) * 8
7373
}
7474
}
7575

agent/tests/agenttest/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn main() {
3737
SkeletonBuilder::new()
3838
.source(&src)
3939
.clang_args([OsStr::new("-I"), builddir.as_os_str()])
40-
.build_and_generate(&builddir.join("agent.skel.rs"))
40+
.build_and_generate(builddir.join("agent.skel.rs"))
4141
.unwrap();
4242
println!("cargo:rerun-if-changed={}", src.display());
4343
}

0 commit comments

Comments
 (0)