Skip to content

Commit 4559f69

Browse files
committed
bump edition to 2024
1 parent 436f9d4 commit 4559f69

Some content is hidden

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

44 files changed

+188
-215
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
matrix:
3535
target:
36-
- wasm32-wasi
36+
- wasm32-wasip1
3737

3838
steps:
3939
- uses: actions/checkout@v4

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ resolver = "2"
99

1010
[workspace.package]
1111
authors = ["Jack Grigg <[email protected]>"]
12-
edition = "2021"
13-
rust-version = "1.65"
12+
edition = "2024"
13+
rust-version = "1.85"
1414
repository = "https://github.com/str4d/rage"
1515
license = "MIT OR Apache-2.0"
1616

age-core/src/format.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
//! Core types and encoding operations used by the age file format.
22
3-
use base64::{prelude::BASE64_STANDARD_NO_PAD, Engine};
3+
use base64::{Engine, prelude::BASE64_STANDARD_NO_PAD};
44
use rand::{
5+
RngCore,
56
distr::{Distribution, Uniform},
6-
rng, RngCore,
7+
rng,
78
};
89
use secrecy::{ExposeSecret, ExposeSecretMut, SecretBox};
910

@@ -61,7 +62,7 @@ pub struct AgeStanza<'a> {
6162
body: Vec<&'a [u8]>,
6263
}
6364

64-
impl<'a> AgeStanza<'a> {
65+
impl AgeStanza<'_> {
6566
/// Decodes and returns the body of this stanza.
6667
pub fn body(&self) -> Vec<u8> {
6768
// An AgeStanza will always contain at least one chunk.
@@ -158,13 +159,13 @@ pub fn grease_the_joint() -> Stanza {
158159
/// Decoding operations for age types.
159160
pub mod read {
160161
use nom::{
162+
IResult,
161163
branch::alt,
162-
bytes::streaming::{tag, take_while1, take_while_m_n},
164+
bytes::streaming::{tag, take_while_m_n, take_while1},
163165
character::streaming::newline,
164166
combinator::{map, map_opt, opt, verify},
165167
multi::{many_till, separated_list1},
166168
sequence::{pair, preceded, terminated},
167-
IResult,
168169
};
169170

170171
use super::{AgeStanza, STANZA_TAG};
@@ -351,12 +352,12 @@ pub mod read {
351352

352353
/// Encoding operations for age types.
353354
pub mod write {
354-
use base64::{prelude::BASE64_STANDARD_NO_PAD, Engine};
355+
use base64::{Engine, prelude::BASE64_STANDARD_NO_PAD};
355356
use cookie_factory::{
357+
SerializeFn, WriteContext,
356358
combinator::string,
357359
multi::separated_list,
358360
sequence::{pair, tuple},
359-
SerializeFn, WriteContext,
360361
};
361362
use std::io::Write;
362363
use std::iter;
@@ -405,7 +406,7 @@ pub mod write {
405406

406407
#[cfg(test)]
407408
mod tests {
408-
use base64::{prelude::BASE64_STANDARD_NO_PAD, Engine};
409+
use base64::{Engine, prelude::BASE64_STANDARD_NO_PAD};
409410
use nom::error::ErrorKind;
410411

411412
use super::{read, write};

age-core/src/plugin.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! These are shared between the client implementation in the `age` crate, and the plugin
44
//! implementations built around the `age-plugin` crate.
55
6-
use rand::{rng, Rng};
6+
use rand::{Rng, rng};
77
use secrecy::zeroize::Zeroize;
88
use std::env;
99
use std::fmt;
@@ -13,7 +13,7 @@ use std::path::Path;
1313
use std::process::{ChildStdin, ChildStdout, Command, Stdio};
1414

1515
use crate::{
16-
format::{grease_the_joint, read, write, Stanza},
16+
format::{Stanza, grease_the_joint, read, write},
1717
io::{DebugReader, DebugWriter},
1818
};
1919

@@ -124,7 +124,7 @@ impl<R: Read, W: Write> Connection<R, W> {
124124
cookie_factory::gen_simple(write::age_stanza(command, metadata, data), &mut self.output)
125125
.map_err(|e| match e {
126126
GenError::IoError(e) => e,
127-
e => io::Error::new(io::ErrorKind::Other, format!("{}", e)),
127+
e => io::Error::other(format!("{}", e)),
128128
})
129129
.and_then(|w| w.flush())
130130
}
@@ -174,7 +174,7 @@ impl<R: Read, W: Write> Connection<R, W> {
174174
Ok(stanza)
175175
}
176176

177-
fn grease_gun(&mut self) -> impl Iterator<Item = Stanza> {
177+
fn grease_gun(&mut self) -> impl Iterator<Item = Stanza> + use<R, W> {
178178
// Add 5% grease
179179
let mut rng = rng();
180180
(0..2).filter_map(move |_| {
@@ -313,7 +313,7 @@ impl<R: Read, W: Write> Connection<R, W> {
313313
/// Grease is applied automatically.
314314
pub struct UnidirSend<'a, R: Read, W: Write>(&'a mut Connection<R, W>);
315315

316-
impl<'a, R: Read, W: Write> UnidirSend<'a, R, W> {
316+
impl<R: Read, W: Write> UnidirSend<'_, R, W> {
317317
/// Send a command.
318318
pub fn send(&mut self, command: &str, metadata: &[&str], data: &[u8]) -> io::Result<()> {
319319
for grease in self.0.grease_gun() {
@@ -341,7 +341,7 @@ impl<'a, R: Read, W: Write> UnidirSend<'a, R, W> {
341341
/// Grease is applied automatically.
342342
pub struct BidirSend<'a, R: Read, W: Write>(&'a mut Connection<R, W>);
343343

344-
impl<'a, R: Read, W: Write> BidirSend<'a, R, W> {
344+
impl<R: Read, W: Write> BidirSend<'_, R, W> {
345345
/// Send a command and receive a response.
346346
pub fn send(&mut self, command: &str, metadata: &[&str], data: &[u8]) -> Result<Stanza> {
347347
for grease in self.0.grease_gun() {
@@ -389,7 +389,7 @@ impl<'a, R: Read, W: Write> BidirSend<'a, R, W> {
389389
/// The possible replies to a bidirectional command.
390390
pub struct Reply<'a, R: Read, W: Write>(&'a mut Connection<R, W>);
391391

392-
impl<'a, R: Read, W: Write> Reply<'a, R, W> {
392+
impl<R: Read, W: Write> Reply<'_, R, W> {
393393
/// Reply with `ok` and optional data.
394394
pub fn ok(self, data: Option<&[u8]>) -> Response {
395395
Response(

age-core/src/primitives.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Primitive cryptographic operations used across various `age` components.
22
33
use chacha20poly1305::{
4-
aead::{self, array::typenum::Unsigned, Aead, AeadCore, KeyInit},
54
ChaCha20Poly1305,
5+
aead::{self, Aead, AeadCore, KeyInit, array::typenum::Unsigned},
66
};
77
use hkdf::Hkdf;
88
use sha2::Sha256;

age-plugin/examples/age-plugin-unencrypted.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ use age_core::{
33
secrecy::ExposeSecret,
44
};
55
use age_plugin::{
6+
Callbacks, PluginHandler,
67
identity::{self, IdentityPluginV1},
78
print_new_identity,
89
recipient::{self, RecipientPluginV1},
9-
run_state_machine, Callbacks, PluginHandler,
10+
run_state_machine,
1011
};
1112
use clap::Parser;
1213

age-plugin/src/identity.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use age_core::{
55
plugin::{self, BidirSend, Connection},
66
secrecy::{ExposeSecret, SecretString},
77
};
8-
use base64::{prelude::BASE64_STANDARD_NO_PAD, Engine};
8+
use base64::{Engine, prelude::BASE64_STANDARD_NO_PAD};
99
use bech32::FromBase32;
1010

1111
use std::collections::HashMap;
@@ -74,7 +74,7 @@ impl IdentityPluginV1 for Infallible {
7474
/// The interface that age plugins can use to interact with an age implementation.
7575
struct BidirCallbacks<'a, 'b, R: io::Read, W: io::Write>(&'b mut BidirSend<'a, R, W>);
7676

77-
impl<'a, 'b, R: io::Read, W: io::Write> Callbacks<Error> for BidirCallbacks<'a, 'b, R, W> {
77+
impl<R: io::Read, W: io::Write> Callbacks<Error> for BidirCallbacks<'_, '_, R, W> {
7878
/// Shows a message to the user.
7979
///
8080
/// This can be used to prompt the user to take some physical action, such as

age-plugin/src/recipient.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
//! Recipient plugin helpers.
22
33
use age_core::{
4-
format::{is_arbitrary_string, FileKey, Stanza},
4+
format::{FileKey, Stanza, is_arbitrary_string},
55
plugin::{self, BidirSend, Connection},
66
secrecy::SecretString,
77
};
8-
use base64::{prelude::BASE64_STANDARD_NO_PAD, Engine};
8+
use base64::{Engine, prelude::BASE64_STANDARD_NO_PAD};
99
use bech32::FromBase32;
1010

1111
use std::collections::HashSet;
@@ -39,7 +39,7 @@ pub trait RecipientPluginV1 {
3939
///
4040
/// Returns an error if the recipient is unknown or invalid.
4141
fn add_recipient(&mut self, index: usize, plugin_name: &str, bytes: &[u8])
42-
-> Result<(), Error>;
42+
-> Result<(), Error>;
4343

4444
/// Stores an identity that the user would like to encrypt age files to.
4545
///
@@ -126,7 +126,7 @@ impl RecipientPluginV1 for Infallible {
126126
/// The interface that age plugins can use to interact with an age implementation.
127127
struct BidirCallbacks<'a, 'b, R: io::Read, W: io::Write>(&'b mut BidirSend<'a, R, W>);
128128

129-
impl<'a, 'b, R: io::Read, W: io::Write> Callbacks<Error> for BidirCallbacks<'a, 'b, R, W> {
129+
impl<R: io::Read, W: io::Write> Callbacks<Error> for BidirCallbacks<'_, '_, R, W> {
130130
/// Shows a message to the user.
131131
///
132132
/// This can be used to prompt the user to take some physical action, such as

age/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,6 @@ harness = false
137137
[package.metadata.docs.rs]
138138
all-features = true
139139
rustdoc-args = ["--cfg", "docsrs"]
140+
141+
[lints.rust]
142+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }

age/benches/parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use age::{x25519, Decryptor, Encryptor};
2-
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
1+
use age::{Decryptor, Encryptor, x25519};
2+
use criterion::{BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
33

44
#[cfg(unix)]
55
use pprof::criterion::{Output, PProfProfiler};

0 commit comments

Comments
 (0)