Skip to content

Commit 15708d5

Browse files
jayantkJayant Krishnamurthy
andauthored
Fix formatting for new nightly rust (#415)
Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
1 parent df3297e commit 15708d5

File tree

7 files changed

+17
-21
lines changed

7 files changed

+17
-21
lines changed

cosmwasm/contracts/pyth/src/contract.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ fn process_batch_attestation(
222222
"batch_size",
223223
format!("{}", batch_attestation.price_attestations.len()),
224224
)
225-
.add_attribute("num_updates", format!("{}", new_attestations_cnt)))
225+
.add_attribute("num_updates", format!("{new_attestations_cnt}")))
226226
}
227227

228228
/// Returns true if the price_feed is newer than the stored one.

cosmwasm/contracts/pyth/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub enum PythContractError {
3333
impl From<PythContractError> for StdError {
3434
fn from(other: PythContractError) -> StdError {
3535
StdError::GenericErr {
36-
msg: format!("{}", other),
36+
msg: format!("{other}"),
3737
}
3838
}
3939
}

pythnet/remote-executor/cli/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ fn main() -> Result<()> {
226226
&ID,
227227
)
228228
.0;
229-
println!("{:?} maps to {:?}", pubkey, executor_key);
229+
println!("{pubkey:?} maps to {executor_key:?}");
230230
Ok(())
231231
}
232232

@@ -282,7 +282,7 @@ pub fn process_transaction(
282282
transaction.sign(signers, rpc_client.get_latest_blockhash()?);
283283
let transaction_signature =
284284
rpc_client.send_and_confirm_transaction_with_spinner(&transaction)?;
285-
println!("Transaction successful : {:?}", transaction_signature);
285+
println!("Transaction successful : {transaction_signature:?}");
286286
Ok(())
287287
}
288288

solana/pyth2wormhole/client/src/attestation_cfg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ impl ToString for SymbolConfig {
265265
product,
266266
price: _,
267267
} => {
268-
format!("Unnamed product {}", product)
268+
format!("Unnamed product {product}")
269269
}
270270
}
271271
}

solana/pyth2wormhole/client/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ async fn main() -> Result<(), ErrBox> {
107107
// off-chain explicitly
108108
if let Action::GetEmitter = cli.action {
109109
let emitter_addr = P2WEmitter::key(None, &cli.p2w_addr);
110-
println!("{}", emitter_addr);
110+
println!("{emitter_addr}");
111111

112112
// Exit early
113113
return Ok(());

solana/pyth2wormhole/client/tests/fixtures/passthrough.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ pub fn passthrough_entrypoint(
1414
account_infos: &[AccountInfo],
1515
_data: &[u8],
1616
) -> Result<(), ProgramError> {
17-
msg!(&format!("Program {}", program_id));
18-
msg!(&format!("account_infos {:?}", account_infos));
17+
msg!(&format!("Program {program_id}"));
18+
msg!(&format!("account_infos {account_infos:?}"));
1919
Ok(())
2020
}
2121

third_party/pyth/p2w-sdk/rust/src/lib.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,9 @@ impl BatchPriceAttestation {
189189
bytes.read_exact(magic_vec.as_mut_slice())?;
190190

191191
if magic_vec.as_slice() != P2W_MAGIC {
192-
return Err(format!(
193-
"Invalid magic {:02X?}, expected {:02X?}",
194-
magic_vec, P2W_MAGIC,
195-
)
196-
.into());
192+
return Err(
193+
format!("Invalid magic {magic_vec:02X?}, expected {P2W_MAGIC:02X?}",).into(),
194+
);
197195
}
198196

199197
let mut major_version_vec = vec![0u8; mem::size_of_val(&P2W_FORMAT_VER_MAJOR)];
@@ -203,8 +201,7 @@ impl BatchPriceAttestation {
203201
// Major must match exactly
204202
if major_version != P2W_FORMAT_VER_MAJOR {
205203
return Err(format!(
206-
"Unsupported format major_version {}, expected {}",
207-
major_version, P2W_FORMAT_VER_MAJOR
204+
"Unsupported format major_version {major_version}, expected {P2W_FORMAT_VER_MAJOR}"
208205
)
209206
.into());
210207
}
@@ -216,8 +213,7 @@ impl BatchPriceAttestation {
216213
// Only older minors are not okay for this codebase
217214
if minor_version < P2W_FORMAT_VER_MINOR {
218215
return Err(format!(
219-
"Unsupported format minor_version {}, expected {} or more",
220-
minor_version, P2W_FORMAT_VER_MINOR
216+
"Unsupported format minor_version {minor_version}, expected {P2W_FORMAT_VER_MINOR} or more"
221217
)
222218
.into());
223219
}
@@ -414,7 +410,7 @@ impl PriceAttestation {
414410
a if a == PriceStatus::Halted as u8 => PriceStatus::Halted,
415411
a if a == PriceStatus::Auction as u8 => PriceStatus::Auction,
416412
other => {
417-
return Err(format!("Invalid status value {}", other).into());
413+
return Err(format!("Invalid status value {other}").into());
418414
}
419415
};
420416

@@ -513,7 +509,7 @@ mod tests {
513509
println!("Regular: {:#?}", &attestation);
514510
println!("Hex: {:#02X?}", &attestation);
515511
let bytes = attestation.serialize();
516-
println!("Hex Bytes: {:02X?}", bytes);
512+
println!("Hex Bytes: {bytes:02X?}");
517513

518514
assert_eq!(
519515
PriceAttestation::deserialize(bytes.as_slice())?,
@@ -543,10 +539,10 @@ mod tests {
543539
let batch_attestation = BatchPriceAttestation {
544540
price_attestations: attestations,
545541
};
546-
println!("Batch hex struct: {:#02X?}", batch_attestation);
542+
println!("Batch hex struct: {batch_attestation:#02X?}");
547543

548544
let serialized = batch_attestation.serialize()?;
549-
println!("Batch hex Bytes: {:02X?}", serialized);
545+
println!("Batch hex Bytes: {serialized:02X?}");
550546

551547
let deserialized: BatchPriceAttestation =
552548
BatchPriceAttestation::deserialize(serialized.as_slice())?;

0 commit comments

Comments
 (0)