Skip to content

Commit 4004749

Browse files
authored
chore: bump to edition 2024 (#960)
* chore: bump to edition 2024 * chore: fix edition 2024 lints * chore: format with edition 2024 * fix: extern block * fmt
1 parent 50134df commit 4004749

File tree

169 files changed

+441
-599
lines changed

Some content is hidden

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

169 files changed

+441
-599
lines changed

Cargo.toml

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

55
[workspace.package]
66
version = "1.1.3"
7-
edition = "2021"
7+
edition = "2024"
88
rust-version = "1.85"
99
authors = ["Alloy Contributors"]
1010
license = "MIT OR Apache-2.0"

crates/dyn-abi/benches/abi.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#![allow(unknown_lints, clippy::incompatible_msrv, missing_docs)]
22

33
use alloy_dyn_abi::{DynSolType, DynSolValue};
4-
use alloy_primitives::{hex, Uint, U256};
5-
use alloy_sol_types::{sol, sol_data, SolType, SolValue};
4+
use alloy_primitives::{U256, Uint, hex};
5+
use alloy_sol_types::{SolType, SolValue, sol, sol_data};
66
use criterion::{
7-
criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion,
7+
BenchmarkGroup, Criterion, criterion_group, criterion_main, measurement::WallTime,
88
};
99
use std::{hint::black_box, time::Duration};
1010

@@ -154,10 +154,10 @@ fn encode_struct_input() -> Input {
154154
fn encode_struct_input_tokens() -> [ethabi::Token; 8] {
155155
let input = encode_struct_input();
156156
[
157-
ethabi::Token::Address(input.tokenIn.0 .0.into()),
158-
ethabi::Token::Address(input.tokenOut.0 .0.into()),
157+
ethabi::Token::Address(input.tokenIn.0.0.into()),
158+
ethabi::Token::Address(input.tokenOut.0.0.into()),
159159
ethabi::Token::Uint(input.fee.to::<u64>().into()),
160-
ethabi::Token::Address(input.recipient.0 .0.into()),
160+
ethabi::Token::Address(input.recipient.0.0.into()),
161161
ethabi::Token::Uint(ethabi::Uint::from_big_endian(&input.deadline.to_be_bytes_vec())),
162162
ethabi::Token::Uint(ethabi::Uint::from_big_endian(&input.amountIn.to_be_bytes_vec())),
163163
ethabi::Token::Uint(ethabi::Uint::from_big_endian(

crates/dyn-abi/benches/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use alloy_dyn_abi::{DynSolType, Specifier};
44
use alloy_sol_type_parser::TypeSpecifier;
55
use criterion::{
6-
criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion,
6+
BenchmarkGroup, Criterion, criterion_group, criterion_main, measurement::WallTime,
77
};
88
use rand::seq::IndexedRandom;
99
use std::{hint::black_box, time::Duration};
@@ -13,7 +13,7 @@ const KEYWORDS: &[&str] =
1313
const COMPLEX: &[&str] = &[
1414
"((uint104,bytes,bytes8,bytes7,address,bool,address,int256,int32,bytes1,uint56,int136),uint80,uint104,address,bool,bytes14,int16,address,string,uint176,uint72,(uint120,uint192,uint256,int232,bool,bool,bool,bytes5,int56,address,uint224,int248,bytes10,int48,int8),string,string,bool,bool)",
1515
"(address,string,(bytes,int48,bytes30,bool,address,bytes30,int48,address,bytes17,bool,uint32),bool,address,bytes28,bytes25,uint136)",
16-
"(uint168,bytes21,address,(bytes,bool,string,address,bool,string,bytes,uint232,int128,int64,uint96,bytes7,int136),bool,uint200[5],bool,bytes,uint240,address,address,bytes15,bytes)"
16+
"(uint168,bytes21,address,(bytes,bool,string,address,bool,string,bytes,uint232,int128,int64,uint96,bytes7,int136),bool,uint200[5],bool,bytes,uint240,address,address,bytes15,bytes)",
1717
];
1818

1919
fn parse(c: &mut Criterion) {

crates/dyn-abi/src/arbitrary.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
#![allow(clippy::arc_with_non_send_sync)]
1111

1212
use crate::{DynSolType, DynSolValue};
13-
use alloy_primitives::{Address, Function, B256, I256, U256};
14-
use arbitrary::{size_hint, Unstructured};
13+
use alloy_primitives::{Address, B256, Function, I256, U256};
14+
use arbitrary::{Unstructured, size_hint};
1515
use core::ops::RangeInclusive;
1616
use proptest::{
17-
collection::{vec as vec_strategy, VecStrategy},
17+
collection::{VecStrategy, vec as vec_strategy},
1818
prelude::*,
1919
strategy::{Flatten, Map, Recursive, TupleUnion, WA},
2020
};

crates/dyn-abi/src/coerce.rs

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
use crate::{dynamic::ty::as_tuple, DynSolType, DynSolValue, Result};
1+
use crate::{DynSolType, DynSolValue, Result, dynamic::ty::as_tuple};
22
use alloc::vec::Vec;
3-
use alloy_primitives::{hex, Address, Function, Sign, I256, U256};
3+
use alloy_primitives::{Address, Function, I256, Sign, U256, hex};
44
use alloy_sol_types::Word;
55
use core::fmt;
66
use parser::{
7-
new_input,
7+
Input, new_input,
88
utils::{array_parser, char_parser, spanned},
9-
Input,
109
};
1110
use winnow::{
11+
ModalParser, ModalResult, Parser,
1212
ascii::{alpha0, alpha1, digit1, hex_digit0, hex_digit1, space0},
1313
combinator::{cut_err, dispatch, empty, fail, opt, preceded, trace},
1414
error::{
@@ -17,7 +17,6 @@ use winnow::{
1717
},
1818
stream::Stream,
1919
token::take_while,
20-
ModalParser, ModalResult, Parser,
2120
};
2221

2322
impl DynSolType {
@@ -588,9 +587,11 @@ mod tests {
588587
.unwrap(),
589588
DynSolValue::Int(I256::MAX, 256)
590589
);
591-
assert!(DynSolType::Int(256)
592-
.coerce_str("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
593-
.is_err());
590+
assert!(
591+
DynSolType::Int(256)
592+
.coerce_str("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
593+
.is_err()
594+
);
594595

595596
assert_eq!(
596597
DynSolType::Int(256).coerce_str("0").unwrap(),
@@ -621,7 +622,11 @@ mod tests {
621622
DynSolValue::Int(I256::MAX, 256)
622623
);
623624
assert_eq!(
624-
DynSolType::Int(256).coerce_str("-57896044618658097711785492504343953926634992332820282019728792003956564819968").unwrap(),
625+
DynSolType::Int(256)
626+
.coerce_str(
627+
"-57896044618658097711785492504343953926634992332820282019728792003956564819968"
628+
)
629+
.unwrap(),
625630
DynSolValue::Int(I256::MIN, 256)
626631
);
627632
}
@@ -681,13 +686,17 @@ mod tests {
681686
);
682687

683688
// 255 bits fails
684-
assert!(DynSolType::Uint(255)
685-
.coerce_str("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
686-
.is_err());
689+
assert!(
690+
DynSolType::Uint(255)
691+
.coerce_str("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
692+
.is_err()
693+
);
687694

688695
assert_eq!(
689696
DynSolType::Uint(256)
690-
.coerce_str("115792089237316195423570985008687907853269984665640564039457584007913129639935")
697+
.coerce_str(
698+
"115792089237316195423570985008687907853269984665640564039457584007913129639935"
699+
)
691700
.unwrap(),
692701
DynSolValue::Uint(U256::MAX, 256)
693702
);
@@ -1191,16 +1200,20 @@ mod tests {
11911200

11921201
#[test]
11931202
fn single_quoted_in_array_must_error() {
1194-
assert!(DynSolType::Array(Box::new(DynSolType::Bool))
1195-
.coerce_str("[true,\"false,false]")
1196-
.is_err());
1203+
assert!(
1204+
DynSolType::Array(Box::new(DynSolType::Bool))
1205+
.coerce_str("[true,\"false,false]")
1206+
.is_err()
1207+
);
11971208
assert!(DynSolType::Array(Box::new(DynSolType::Bool)).coerce_str("[false\"]").is_err());
1198-
assert!(DynSolType::Array(Box::new(DynSolType::Bool))
1199-
.coerce_str("[true,false\"]")
1200-
.is_err());
1201-
assert!(DynSolType::Array(Box::new(DynSolType::Bool))
1202-
.coerce_str("[true,\"false\",false]")
1203-
.is_err());
1209+
assert!(
1210+
DynSolType::Array(Box::new(DynSolType::Bool)).coerce_str("[true,false\"]").is_err()
1211+
);
1212+
assert!(
1213+
DynSolType::Array(Box::new(DynSolType::Bool))
1214+
.coerce_str("[true,\"false\",false]")
1215+
.is_err()
1216+
);
12041217
assert!(DynSolType::Array(Box::new(DynSolType::Bool)).coerce_str("[true,false]").is_ok());
12051218
}
12061219

crates/dyn-abi/src/dynamic/error.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ mod test {
108108
#[test]
109109
fn decode_revert_message() {
110110
let error = DynSolError::revert();
111-
let data = hex!("08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000042020202000000000000000000000000000000000000000000000000000000000");
111+
let data = hex!(
112+
"08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000042020202000000000000000000000000000000000000000000000000000000000"
113+
);
112114

113115
let decoded = error.decode_error(&data).unwrap();
114116
assert_eq!(decoded.body, vec!(DynSolValue::String(" ".into())));

crates/dyn-abi/src/dynamic/event.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::{DynSolType, DynSolValue, Error, Result};
22
use alloc::vec::Vec;
3-
use alloy_primitives::{IntoLogData, Log, LogData, B256};
3+
use alloy_primitives::{B256, IntoLogData, Log, LogData};
44

55
/// A dynamic ABI event.
66
///
@@ -54,7 +54,7 @@ impl DynSolEvent {
5454

5555
match topics.size_hint() {
5656
(n, Some(m)) if n == m && n != num_topics => {
57-
return Err(Error::TopicLengthMismatch { expected: num_topics, actual: n })
57+
return Err(Error::TopicLengthMismatch { expected: num_topics, actual: n });
5858
}
5959
_ => {}
6060
}
@@ -172,7 +172,7 @@ impl IntoLogData for DecodedEvent {
172172
#[cfg(test)]
173173
mod test {
174174
use super::*;
175-
use alloy_primitives::{address, b256, bytes, U256};
175+
use alloy_primitives::{U256, address, b256, bytes};
176176

177177
#[test]
178178
fn it_decodes_a_simple_log() {

crates/dyn-abi/src/dynamic/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ impl DynSolType {
653653
mod tests {
654654
use super::*;
655655
use alloc::string::ToString;
656-
use alloy_primitives::{hex, Address};
656+
use alloy_primitives::{Address, hex};
657657

658658
#[test]
659659
fn dynamically_encodes() {

crates/dyn-abi/src/dynamic/value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl DynSolValue {
208208
.iter()
209209
.map(Self::as_type)
210210
.collect::<Option<Vec<_>>>()
211-
.map(DynSolType::Tuple)
211+
.map(DynSolType::Tuple);
212212
}
213213
Self::Array(inner) => DynSolType::Array(Box::new(Self::as_type(inner.first()?)?)),
214214
Self::FixedArray(inner) => {

crates/dyn-abi/src/eip712/coerce.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use alloc::{
33
string::{String, ToString},
44
vec::Vec,
55
};
6-
use alloy_primitives::{hex, Address, Function, I256, U256};
6+
use alloy_primitives::{Address, Function, I256, U256, hex};
77

88
impl DynSolType {
99
/// Coerce a [`serde_json::Value`] to a [`DynSolValue`] via this type.

0 commit comments

Comments
 (0)