Skip to content

Commit e771269

Browse files
committed
fix cargo fmt
1 parent 001de0e commit e771269

File tree

147 files changed

+1070
-1029
lines changed

Some content is hidden

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

147 files changed

+1070
-1029
lines changed

crates/anvil/core/src/eth/serde_helpers.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub mod sequence {
2525
return Err(serde::de::Error::custom(format!(
2626
"expected params sequence with length 1 but got {}",
2727
seq.len()
28-
)))
28+
)));
2929
}
3030
Ok(seq.remove(0))
3131
}
@@ -44,7 +44,7 @@ pub mod empty_params {
4444
return Err(serde::de::Error::custom(format!(
4545
"expected params sequence with length 0 but got {}",
4646
seq.len()
47-
)))
47+
)));
4848
}
4949
Ok(())
5050
}

crates/anvil/core/src/eth/transaction/mod.rs

+34-34
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ pub fn transaction_request_to_typed(
8787
to,
8888
) {
8989
// legacy transaction
90-
(Some(0), _, None, None, None, None, None, None, _) |
91-
(None, Some(_), None, None, None, None, None, None, _) => {
90+
(Some(0), _, None, None, None, None, None, None, _)
91+
| (None, Some(_), None, None, None, None, None, None, _) => {
9292
Some(TypedTransactionRequest::Legacy(TxLegacy {
9393
nonce: nonce.unwrap_or_default(),
9494
gas_price: gas_price.unwrap_or_default(),
@@ -100,8 +100,8 @@ pub fn transaction_request_to_typed(
100100
}))
101101
}
102102
// EIP2930
103-
(Some(1), _, None, None, _, None, None, None, _) |
104-
(None, _, None, None, Some(_), None, None, None, _) => {
103+
(Some(1), _, None, None, _, None, None, None, _)
104+
| (None, _, None, None, Some(_), None, None, None, _) => {
105105
Some(TypedTransactionRequest::EIP2930(TxEip2930 {
106106
nonce: nonce.unwrap_or_default(),
107107
gas_price: gas_price.unwrap_or_default(),
@@ -114,10 +114,10 @@ pub fn transaction_request_to_typed(
114114
}))
115115
}
116116
// EIP1559
117-
(Some(2), None, _, _, _, _, None, None, _) |
118-
(None, None, Some(_), _, _, _, None, None, _) |
119-
(None, None, _, Some(_), _, _, None, None, _) |
120-
(None, None, None, None, None, _, None, None, _) => {
117+
(Some(2), None, _, _, _, _, None, None, _)
118+
| (None, None, Some(_), _, _, _, None, None, _)
119+
| (None, None, _, Some(_), _, _, None, None, _)
120+
| (None, None, None, None, None, _, None, None, _) => {
121121
// Empty fields fall back to the canonical transaction schema.
122122
Some(TypedTransactionRequest::EIP1559(TxEip1559 {
123123
nonce: nonce.unwrap_or_default(),
@@ -163,9 +163,9 @@ pub fn transaction_request_to_typed(
163163
}
164164

165165
fn has_optimism_fields(other: &OtherFields) -> bool {
166-
other.contains_key("sourceHash") &&
167-
other.contains_key("mint") &&
168-
other.contains_key("isSystemTx")
166+
other.contains_key("sourceHash")
167+
&& other.contains_key("mint")
168+
&& other.contains_key("isSystemTx")
169169
}
170170

171171
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -214,7 +214,7 @@ impl MaybeImpersonatedTransaction {
214214
/// Returns the hash of the transaction
215215
pub fn hash(&self) -> B256 {
216216
if let Some(sender) = self.impersonated_sender {
217-
return self.transaction.impersonated_hash(sender)
217+
return self.transaction.impersonated_hash(sender);
218218
}
219219
self.transaction.hash()
220220
}
@@ -1047,7 +1047,7 @@ impl Encodable2718 for TypedTransaction {
10471047
impl Decodable2718 for TypedTransaction {
10481048
fn typed_decode(ty: u8, buf: &mut &[u8]) -> Result<Self, Eip2718Error> {
10491049
if ty == 0x7E {
1050-
return Ok(Self::Deposit(DepositTransaction::decode(buf)?))
1050+
return Ok(Self::Deposit(DepositTransaction::decode(buf)?));
10511051
}
10521052
match TxEnvelope::typed_decode(ty, buf)? {
10531053
TxEnvelope::Eip2930(tx) => Ok(Self::EIP2930(tx)),
@@ -1122,12 +1122,12 @@ pub struct DepositReceipt<T = Receipt<alloy_primitives::Log>> {
11221122

11231123
impl DepositReceipt {
11241124
fn payload_len(&self) -> usize {
1125-
self.inner.receipt.status.length() +
1126-
self.inner.receipt.cumulative_gas_used.length() +
1127-
self.inner.logs_bloom.length() +
1128-
self.inner.receipt.logs.length() +
1129-
self.deposit_nonce.map_or(0, |n| n.length()) +
1130-
self.deposit_receipt_version.map_or(0, |n| n.length())
1125+
self.inner.receipt.status.length()
1126+
+ self.inner.receipt.cumulative_gas_used.length()
1127+
+ self.inner.logs_bloom.length()
1128+
+ self.inner.receipt.logs.length()
1129+
+ self.deposit_nonce.map_or(0, |n| n.length())
1130+
+ self.deposit_receipt_version.map_or(0, |n| n.length())
11311131
}
11321132

11331133
/// Returns the rlp header for the receipt payload.
@@ -1227,11 +1227,11 @@ pub enum TypedReceipt<T = Receipt<alloy_primitives::Log>> {
12271227
impl<T> TypedReceipt<T> {
12281228
pub fn as_receipt_with_bloom(&self) -> &ReceiptWithBloom<T> {
12291229
match self {
1230-
Self::Legacy(r) |
1231-
Self::EIP1559(r) |
1232-
Self::EIP2930(r) |
1233-
Self::EIP4844(r) |
1234-
Self::EIP7702(r) => r,
1230+
Self::Legacy(r)
1231+
| Self::EIP1559(r)
1232+
| Self::EIP2930(r)
1233+
| Self::EIP4844(r)
1234+
| Self::EIP7702(r) => r,
12351235
Self::Deposit(r) => &r.inner,
12361236
}
12371237
}
@@ -1240,11 +1240,11 @@ impl<T> TypedReceipt<T> {
12401240
impl<T> From<TypedReceipt<T>> for ReceiptWithBloom<T> {
12411241
fn from(value: TypedReceipt<T>) -> Self {
12421242
match value {
1243-
TypedReceipt::Legacy(r) |
1244-
TypedReceipt::EIP1559(r) |
1245-
TypedReceipt::EIP2930(r) |
1246-
TypedReceipt::EIP4844(r) |
1247-
TypedReceipt::EIP7702(r) => r,
1243+
TypedReceipt::Legacy(r)
1244+
| TypedReceipt::EIP1559(r)
1245+
| TypedReceipt::EIP2930(r)
1246+
| TypedReceipt::EIP4844(r)
1247+
| TypedReceipt::EIP7702(r) => r,
12481248
TypedReceipt::Deposit(r) => r.inner,
12491249
}
12501250
}
@@ -1412,11 +1412,11 @@ impl Encodable2718 for TypedReceipt {
14121412
out.put_u8(ty);
14131413
}
14141414
match self {
1415-
Self::Legacy(r) |
1416-
Self::EIP2930(r) |
1417-
Self::EIP1559(r) |
1418-
Self::EIP4844(r) |
1419-
Self::EIP7702(r) => r.encode(out),
1415+
Self::Legacy(r)
1416+
| Self::EIP2930(r)
1417+
| Self::EIP1559(r)
1418+
| Self::EIP4844(r)
1419+
| Self::EIP7702(r) => r.encode(out),
14201420
Self::Deposit(r) => r.encode(out),
14211421
}
14221422
}

crates/anvil/server/src/ipc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl tokio_util::codec::Decoder for JsonRpcCodec {
159159
return match String::from_utf8(bts.as_ref().to_vec()) {
160160
Ok(val) => Ok(Some(val)),
161161
Err(_) => Ok(None),
162-
}
162+
};
163163
}
164164
}
165165
Ok(None)

crates/anvil/server/src/pubsub.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<Handler: PubSubRpcHandler> PubSubContext<Handler> {
6868
let mut subscriptions = self.subscriptions.lock();
6969
if let Some(idx) = subscriptions.iter().position(|(i, _)| id == i) {
7070
trace!(target: "rpc", ?id, "removed subscription");
71-
return Some(subscriptions.swap_remove(idx).1)
71+
return Some(subscriptions.swap_remove(idx).1);
7272
}
7373
None
7474
}
@@ -174,7 +174,7 @@ where
174174
error!(target: "rpc", ?err, "Failed to send message");
175175
}
176176
} else {
177-
break
177+
break;
178178
}
179179
}
180180

@@ -183,7 +183,7 @@ where
183183
if let Poll::Ready(Err(err)) = pin.connection.poll_flush_unpin(cx) {
184184
trace!(target: "rpc", ?err, "websocket err");
185185
// close the connection
186-
return Poll::Ready(())
186+
return Poll::Ready(());
187187
}
188188

189189
loop {
@@ -195,25 +195,25 @@ where
195195
Err(err) => match err {
196196
RequestError::Axum(err) => {
197197
trace!(target: "rpc", ?err, "client disconnected");
198-
return Poll::Ready(())
198+
return Poll::Ready(());
199199
}
200200
RequestError::Io(err) => {
201201
trace!(target: "rpc", ?err, "client disconnected");
202-
return Poll::Ready(())
202+
return Poll::Ready(());
203203
}
204204
RequestError::Serde(err) => {
205205
pin.process_request(Err(err));
206206
}
207207
RequestError::Disconnect => {
208208
trace!(target: "rpc", "client disconnected");
209-
return Poll::Ready(())
209+
return Poll::Ready(());
210210
}
211211
},
212212
_ => {}
213213
},
214214
Poll::Ready(None) => {
215215
trace!(target: "rpc", "socket connection finished");
216-
return Poll::Ready(())
216+
return Poll::Ready(());
217217
}
218218
Poll::Pending => break,
219219
}
@@ -256,7 +256,7 @@ where
256256
}
257257

258258
if !progress {
259-
return Poll::Pending
259+
return Poll::Pending;
260260
}
261261
}
262262
}

crates/anvil/src/args.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn run_command(args: Anvil) -> Result<()> {
4242
&mut std::io::stdout(),
4343
),
4444
}
45-
return Ok(())
45+
return Ok(());
4646
}
4747

4848
let _ = fdlimit::raise_fd_limit();

crates/anvil/src/cmd.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ impl Future for PeriodicStateDumper {
653653
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
654654
let this = self.get_mut();
655655
if this.dump_state.is_none() {
656-
return Poll::Pending
656+
return Poll::Pending;
657657
}
658658

659659
loop {
@@ -664,7 +664,7 @@ impl Future for PeriodicStateDumper {
664664
}
665665
Poll::Pending => {
666666
this.in_progress_dump = Some(flush);
667-
return Poll::Pending
667+
return Poll::Pending;
668668
}
669669
}
670670
}
@@ -675,7 +675,7 @@ impl Future for PeriodicStateDumper {
675675
this.in_progress_dump =
676676
Some(Box::pin(Self::dump_state(api, path, this.preserve_historical_states)));
677677
} else {
678-
break
678+
break;
679679
}
680680
}
681681

@@ -705,7 +705,7 @@ impl StateFile {
705705
}
706706
let mut state = Self { path, state: None };
707707
if !state.path.exists() {
708-
return Ok(state)
708+
return Ok(state);
709709
}
710710

711711
state.state = Some(SerializableState::load(&state.path).map_err(|err| err.to_string())?);
@@ -740,14 +740,14 @@ impl FromStr for ForkUrl {
740740
fn from_str(s: &str) -> Result<Self, Self::Err> {
741741
if let Some((url, block)) = s.rsplit_once('@') {
742742
if block == "latest" {
743-
return Ok(Self { url: url.to_string(), block: None })
743+
return Ok(Self { url: url.to_string(), block: None });
744744
}
745745
// this will prevent false positives for auths `user:[email protected]`
746746
if !block.is_empty() && !block.contains(':') && !block.contains('.') {
747747
let block: u64 = block
748748
.parse()
749749
.map_err(|_| format!("Failed to parse block number: `{block}`"))?;
750-
return Ok(Self { url: url.to_string(), block: Some(block) })
750+
return Ok(Self { url: url.to_string(), block: Some(block) });
751751
}
752752
}
753753
Ok(Self { url: s.to_string(), block: None })

0 commit comments

Comments
 (0)