chore: clippy (#750)

* chore: clippy

* chore: fmt
This commit is contained in:
thesimplekid
2025-05-14 15:55:37 +01:00
committed by GitHub
parent 056ddecfeb
commit e268866446
38 changed files with 65 additions and 82 deletions

View File

@@ -54,9 +54,9 @@ impl MintUrl {
.skip(1) .skip(1)
.collect::<Vec<&str>>() .collect::<Vec<&str>>()
.join("/"); .join("/");
let mut formatted_url = format!("{}://{}", protocol, host); let mut formatted_url = format!("{protocol}://{host}");
if !path.is_empty() { if !path.is_empty() {
formatted_url.push_str(&format!("/{}/", path)); formatted_url.push_str(&format!("/{path}/"));
} }
Ok(formatted_url) Ok(formatted_url)
} }

View File

@@ -169,7 +169,7 @@ impl std::fmt::Display for RoutePath {
}; };
// Remove the quotes from the JSON string // Remove the quotes from the JSON string
let path = json_str.trim_matches('"'); let path = json_str.trim_matches('"');
write!(f, "{}", path) write!(f, "{path}")
} }
} }

View File

@@ -231,7 +231,7 @@ impl fmt::Display for BlindAuthToken {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let json_string = serde_json::to_string(&self.auth_proof).map_err(|_| fmt::Error)?; let json_string = serde_json::to_string(&self.auth_proof).map_err(|_| fmt::Error)?;
let encoded = general_purpose::URL_SAFE.encode(json_string); let encoded = general_purpose::URL_SAFE.encode(json_string);
write!(f, "authA{}", encoded) write!(f, "authA{encoded}")
} }
} }

View File

@@ -570,7 +570,7 @@ impl fmt::Display for PaymentMethod {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self { match self {
PaymentMethod::Bolt11 => write!(f, "bolt11"), PaymentMethod::Bolt11 => write!(f, "bolt11"),
PaymentMethod::Custom(p) => write!(f, "{}", p), PaymentMethod::Custom(p) => write!(f, "{p}"),
} }
} }
} }

View File

@@ -33,7 +33,7 @@ impl fmt::Display for Token {
Self::TokenV4(token) => token.to_string(), Self::TokenV4(token) => token.to_string(),
}; };
write!(f, "{}", token) write!(f, "{token}")
} }
} }
@@ -300,7 +300,7 @@ impl fmt::Display for TokenV3 {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let json_string = serde_json::to_string(self).map_err(|_| fmt::Error)?; let json_string = serde_json::to_string(self).map_err(|_| fmt::Error)?;
let encoded = general_purpose::URL_SAFE.encode(json_string); let encoded = general_purpose::URL_SAFE.encode(json_string);
write!(f, "cashuA{}", encoded) write!(f, "cashuA{encoded}")
} }
} }
@@ -387,7 +387,7 @@ impl fmt::Display for TokenV4 {
let mut data = Vec::new(); let mut data = Vec::new();
ciborium::into_writer(self, &mut data).map_err(|e| fmt::Error::custom(e.to_string()))?; ciborium::into_writer(self, &mut data).map_err(|e| fmt::Error::custom(e.to_string()))?;
let encoded = general_purpose::URL_SAFE.encode(data); let encoded = general_purpose::URL_SAFE.encode(data);
write!(f, "cashuB{}", encoded) write!(f, "cashuB{encoded}")
} }
} }

View File

@@ -49,7 +49,7 @@ impl fmt::Display for State {
Self::PendingSpent => "PENDING_SPENT", Self::PendingSpent => "PENDING_SPENT",
}; };
write!(f, "{}", s) write!(f, "{s}")
} }
} }

View File

@@ -575,7 +575,7 @@ impl fmt::Display for TagKind {
Self::Locktime => write!(f, "locktime"), Self::Locktime => write!(f, "locktime"),
Self::Refund => write!(f, "refund"), Self::Refund => write!(f, "refund"),
Self::Pubkeys => write!(f, "pubkeys"), Self::Pubkeys => write!(f, "pubkeys"),
Self::Custom(kind) => write!(f, "{}", kind), Self::Custom(kind) => write!(f, "{kind}"),
} }
} }
} }

View File

@@ -45,7 +45,7 @@ impl fmt::Display for TransportType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use serde::ser::Error; use serde::ser::Error;
let t = serde_json::to_string(self).map_err(|e| fmt::Error::custom(e.to_string()))?; let t = serde_json::to_string(self).map_err(|e| fmt::Error::custom(e.to_string()))?;
write!(f, "{}", t) write!(f, "{t}")
} }
} }
@@ -278,7 +278,7 @@ impl fmt::Display for PaymentRequest {
let mut data = Vec::new(); let mut data = Vec::new();
ciborium::into_writer(self, &mut data).map_err(|e| fmt::Error::custom(e.to_string()))?; ciborium::into_writer(self, &mut data).map_err(|e| fmt::Error::custom(e.to_string()))?;
let encoded = general_purpose::URL_SAFE.encode(data); let encoded = general_purpose::URL_SAFE.encode(data);
write!(f, "{}{}", PAYMENT_REQUEST_PREFIX, encoded) write!(f, "{PAYMENT_REQUEST_PREFIX}{encoded}")
} }
} }

View File

@@ -28,7 +28,7 @@ impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self { match self {
Self::InvalidHexCharacter { c, index } => { Self::InvalidHexCharacter { c, index } => {
write!(f, "Invalid character {} at position {}", c, index) write!(f, "Invalid character {c} at position {index}")
} }
Self::OddLength => write!(f, "Odd number of digits"), Self::OddLength => write!(f, "Odd number of digits"),
} }

View File

@@ -100,7 +100,7 @@ async fn main() -> Result<()> {
let sqlx_filter = "sqlx=warn,hyper_util=warn,reqwest=warn"; let sqlx_filter = "sqlx=warn,hyper_util=warn,reqwest=warn";
let env_filter = EnvFilter::new(format!("{},{}", default_filter, sqlx_filter)); let env_filter = EnvFilter::new(format!("{default_filter},{sqlx_filter}"));
// Parse input // Parse input
tracing_subscriber::fmt().with_env_filter(env_filter).init(); tracing_subscriber::fmt().with_env_filter(env_filter).init();

View File

@@ -12,7 +12,7 @@ pub async fn store_nostr_last_checked(
last_checked: u32, last_checked: u32,
) -> Result<()> { ) -> Result<()> {
let key_hex = hex::encode(verifying_key.to_bytes()); let key_hex = hex::encode(verifying_key.to_bytes());
let file_path = work_dir.join(format!("nostr_last_checked_{}", key_hex)); let file_path = work_dir.join(format!("nostr_last_checked_{key_hex}"));
fs::write(file_path, last_checked.to_string())?; fs::write(file_path, last_checked.to_string())?;
@@ -25,7 +25,7 @@ pub async fn get_nostr_last_checked(
verifying_key: &PublicKey, verifying_key: &PublicKey,
) -> Result<Option<u32>> { ) -> Result<Option<u32>> {
let key_hex = hex::encode(verifying_key.to_bytes()); let key_hex = hex::encode(verifying_key.to_bytes());
let file_path = work_dir.join(format!("nostr_last_checked_{}", key_hex)); let file_path = work_dir.join(format!("nostr_last_checked_{key_hex}"));
match fs::read_to_string(file_path) { match fs::read_to_string(file_path) {
Ok(content) => { Ok(content) => {

View File

@@ -60,7 +60,7 @@ pub async fn cat_device_login(
if let Err(e) = if let Err(e) =
token_storage::save_tokens(work_dir, &mint_url, &access_token, &refresh_token).await token_storage::save_tokens(work_dir, &mint_url, &access_token, &refresh_token).await
{ {
println!("Warning: Failed to save tokens to file: {}", e); println!("Warning: Failed to save tokens to file: {e}");
} else { } else {
println!("Tokens saved to work directory"); println!("Tokens saved to work directory");
} }
@@ -68,8 +68,8 @@ pub async fn cat_device_login(
// Print a cute ASCII cat // Print a cute ASCII cat
println!("\nAuthentication successful! 🎉\n"); println!("\nAuthentication successful! 🎉\n");
println!("\nYour tokens:"); println!("\nYour tokens:");
println!("access_token: {}", access_token); println!("access_token: {access_token}");
println!("refresh_token: {}", refresh_token); println!("refresh_token: {refresh_token}");
Ok(()) Ok(())
} }
@@ -125,14 +125,11 @@ async fn get_device_code_token(mint_info: &MintInfo, client_id: &str) -> (String
let interval = device_code_data["interval"].as_u64().unwrap_or(5); let interval = device_code_data["interval"].as_u64().unwrap_or(5);
println!("\nTo login, visit: {}", verification_uri); println!("\nTo login, visit: {verification_uri}");
println!("And enter code: {}\n", user_code); println!("And enter code: {user_code}\n");
if verification_uri_complete != verification_uri { if verification_uri_complete != verification_uri {
println!( println!("Or visit this URL directly: {verification_uri_complete}\n");
"Or visit this URL directly: {}\n",
verification_uri_complete
);
} }
// Poll for the token // Poll for the token
@@ -187,7 +184,7 @@ async fn get_device_code_token(mint_info: &MintInfo, client_id: &str) -> (String
continue; continue;
} else { } else {
// For other errors, exit with an error message // For other errors, exit with an error message
panic!("Authentication failed: {}", error); panic!("Authentication failed: {error}");
} }
} }
} }

View File

@@ -67,15 +67,15 @@ pub async fn cat_login(
if let Err(e) = if let Err(e) =
token_storage::save_tokens(work_dir, &mint_url, &access_token, &refresh_token).await token_storage::save_tokens(work_dir, &mint_url, &access_token, &refresh_token).await
{ {
println!("Warning: Failed to save tokens to file: {}", e); println!("Warning: Failed to save tokens to file: {e}");
} else { } else {
println!("Tokens saved to work directory"); println!("Tokens saved to work directory");
} }
println!("\nAuthentication successful! 🎉\n"); println!("\nAuthentication successful! 🎉\n");
println!("\nYour tokens:"); println!("\nYour tokens:");
println!("access_token: {}", access_token); println!("access_token: {access_token}");
println!("refresh_token: {}", refresh_token); println!("refresh_token: {refresh_token}");
Ok(()) Ok(())
} }

View File

@@ -5,7 +5,7 @@ pub async fn check_spent(multi_mint_wallet: &MultiMintWallet) -> Result<()> {
for wallet in multi_mint_wallet.get_wallets().await { for wallet in multi_mint_wallet.get_wallets().await {
let amount = wallet.check_all_pending_proofs().await?; let amount = wallet.check_all_pending_proofs().await?;
println!("Amount marked as spent: {}", amount); println!("Amount marked as spent: {amount}");
} }
Ok(()) Ok(())

View File

@@ -50,7 +50,7 @@ pub async fn create_request(
transports: vec![nostr_transport], transports: vec![nostr_transport],
}; };
println!("{}", req); println!("{req}");
let client = NostrClient::new(keys); let client = NostrClient::new(keys);
@@ -86,7 +86,7 @@ pub async fn create_request(
.receive(&token.to_string(), ReceiveOptions::default()) .receive(&token.to_string(), ReceiveOptions::default())
.await?; .await?;
println!("Received {}", amount); println!("Received {amount}");
exit = true; exit = true;
} }
Ok(exit) // Set to true to exit from the loop Ok(exit) // Set to true to exit from the loop

View File

@@ -163,13 +163,13 @@ pub async fn pay(
// Process payment // Process payment
let quote = wallet.melt_quote(bolt11.to_string(), options).await?; let quote = wallet.melt_quote(bolt11.to_string(), options).await?;
println!("{:?}", quote); println!("{quote:?}");
let melt = wallet.melt(&quote.id).await?; let melt = wallet.melt(&quote.id).await?;
println!("Paid invoice: {}", melt.state); println!("Paid invoice: {}", melt.state);
if let Some(preimage) = melt.preimage { if let Some(preimage) = melt.preimage {
println!("Payment preimage: {}", preimage); println!("Payment preimage: {preimage}");
} }
} }

View File

@@ -46,7 +46,7 @@ pub async fn mint(
.ok_or(anyhow!("Amount must be defined"))?; .ok_or(anyhow!("Amount must be defined"))?;
let quote = wallet.mint_quote(Amount::from(amount), description).await?; let quote = wallet.mint_quote(Amount::from(amount), description).await?;
println!("Quote: {:#?}", quote); println!("Quote: {quote:#?}");
println!("Please pay: {}", quote.request); println!("Please pay: {}", quote.request);

View File

@@ -97,7 +97,7 @@ pub async fn mint_blind_auth(
) )
.await .await
{ {
println!("Warning: Failed to save refreshed tokens: {}", e); println!("Warning: Failed to save refreshed tokens: {e}");
} }
// Try setting the new access token // Try setting the new access token

View File

@@ -19,7 +19,7 @@ pub async fn mint_info(proxy: Option<Url>, sub_command_args: &MintInfoSubcommand
let info = client.get_mint_info().await?; let info = client.get_mint_info().await?;
println!("{:#?}", info); println!("{info:#?}");
Ok(()) Ok(())
} }

View File

@@ -162,7 +162,7 @@ pub async fn pay_request(
if status.is_success() { if status.is_success() {
println!("Successfully posted payment"); println!("Successfully posted payment");
} else { } else {
println!("{:?}", res); println!("{res:?}");
println!("Error posting payment"); println!("Error posting payment");
} }
} }

View File

@@ -5,7 +5,7 @@ pub async fn mint_pending(multi_mint_wallet: &MultiMintWallet) -> Result<()> {
let amounts = multi_mint_wallet.check_all_mint_quotes(None).await?; let amounts = multi_mint_wallet.check_all_mint_quotes(None).await?;
for (unit, amount) in amounts { for (unit, amount) in amounts {
println!("Unit: {}, Amount: {}", unit, amount); println!("Unit: {unit}, Amount: {amount}");
} }
Ok(()) Ok(())

View File

@@ -115,7 +115,7 @@ pub async fn receive(
total_amount += amount; total_amount += amount;
} }
Err(err) => { Err(err) => {
println!("{}", err); println!("{err}");
} }
} }
} }
@@ -124,7 +124,7 @@ pub async fn receive(
} }
}; };
println!("Received: {}", amount); println!("Received: {amount}");
Ok(()) Ok(())
} }

View File

@@ -37,7 +37,7 @@ pub async fn restore(
let amount = wallet.restore().await?; let amount = wallet.restore().await?;
println!("Restored {}", amount); println!("Restored {amount}");
Ok(()) Ok(())
} }

View File

@@ -169,7 +169,7 @@ pub async fn send(
println!("{}", token.to_v3_string()); println!("{}", token.to_v3_string());
} }
false => { false => {
println!("{}", token); println!("{token}");
} }
} }

View File

@@ -33,7 +33,7 @@ pub async fn update_mint_url(
wallet.update_mint_url(new_mint_url.clone()).await?; wallet.update_mint_url(new_mint_url.clone()).await?;
println!("Mint Url changed from {} to {}", old_mint_url, new_mint_url); println!("Mint Url changed from {old_mint_url} to {new_mint_url}");
Ok(()) Ok(())
} }

View File

@@ -10,7 +10,7 @@ use cdk::Amount;
/// Helper function to get user input with a prompt /// Helper function to get user input with a prompt
pub fn get_user_input(prompt: &str) -> Result<String> { pub fn get_user_input(prompt: &str) -> Result<String> {
println!("{}", prompt); println!("{prompt}");
let mut user_input = String::new(); let mut user_input = String::new();
io::stdout().flush()?; io::stdout().flush()?;
io::stdin().read_line(&mut user_input)?; io::stdin().read_line(&mut user_input)?;

View File

@@ -407,8 +407,7 @@ impl From<Error> for ErrorResponse {
ErrorResponse { ErrorResponse {
code: ErrorCode::TransactionUnbalanced, code: ErrorCode::TransactionUnbalanced,
error: Some(format!( error: Some(format!(
"Inputs: {}, Outputs: {}, expected_fee: {}", "Inputs: {inputs_total}, Outputs: {outputs_total}, expected_fee: {fee_expected}",
inputs_total, outputs_total, fee_expected,
)), )),
detail: Some("Transaction inputs should equal outputs less fee".to_string()), detail: Some("Transaction inputs should equal outputs less fee".to_string()),
} }

View File

@@ -31,8 +31,7 @@ async fn main() -> Result<()> {
let rustls_filter = "rustls=warn"; let rustls_filter = "rustls=warn";
let env_filter = EnvFilter::new(format!( let env_filter = EnvFilter::new(format!(
"{},{},{},{},{}", "{default_filter},{sqlx_filter},{hyper_filter},{h2_filter},{rustls_filter}"
default_filter, sqlx_filter, hyper_filter, h2_filter, rustls_filter
)); ));
tracing_subscriber::fmt().with_env_filter(env_filter).init(); tracing_subscriber::fmt().with_env_filter(env_filter).init();

View File

@@ -166,10 +166,7 @@ pub fn setup_tracing() {
let sqlx_filter = "sqlx=warn"; let sqlx_filter = "sqlx=warn";
let hyper_filter = "hyper=warn"; let hyper_filter = "hyper=warn";
let env_filter = EnvFilter::new(format!( let env_filter = EnvFilter::new(format!("{default_filter},{sqlx_filter},{hyper_filter}"));
"{},{},{}",
default_filter, sqlx_filter, hyper_filter
));
// Ok if successful, Err if already initialized // Ok if successful, Err if already initialized
// Allows us to setup tracing at the start of several parallel tests // Allows us to setup tracing at the start of several parallel tests

View File

@@ -36,7 +36,7 @@ pub fn get_mint_addr() -> String {
} }
pub fn get_mint_port(which: &str) -> u16 { pub fn get_mint_port(which: &str) -> u16 {
let dir = env::var(format!("CDK_ITESTS_MINT_PORT_{}", which)).expect("Mint port not set"); let dir = env::var(format!("CDK_ITESTS_MINT_PORT_{which}")).expect("Mint port not set");
dir.parse().unwrap() dir.parse().unwrap()
} }
@@ -244,7 +244,7 @@ pub async fn start_regtest_end(sender: Sender<()>, notify: Arc<Notify>) -> anyho
tracing::info!("Started lnd node"); tracing::info!("Started lnd node");
let lnd_client = LndClient::new( let lnd_client = LndClient::new(
format!("https://{}", LND_RPC_ADDR), format!("https://{LND_RPC_ADDR}"),
get_lnd_cert_file_path(&lnd_dir), get_lnd_cert_file_path(&lnd_dir),
get_lnd_macaroon_path(&lnd_dir), get_lnd_macaroon_path(&lnd_dir),
) )
@@ -261,7 +261,7 @@ pub async fn start_regtest_end(sender: Sender<()>, notify: Arc<Notify>) -> anyho
tracing::info!("Started second lnd node"); tracing::info!("Started second lnd node");
let lnd_two_client = LndClient::new( let lnd_two_client = LndClient::new(
format!("https://{}", LND_TWO_RPC_ADDR), format!("https://{LND_TWO_RPC_ADDR}"),
get_lnd_cert_file_path(&lnd_two_dir), get_lnd_cert_file_path(&lnd_two_dir),
get_lnd_macaroon_path(&lnd_two_dir), get_lnd_macaroon_path(&lnd_two_dir),
) )

View File

@@ -60,7 +60,7 @@ pub async fn attempt_to_swap_pending(wallet: &Wallet) -> Result<()> {
Err(err) => match err { Err(err) => match err {
cdk::error::Error::TokenPending => (), cdk::error::Error::TokenPending => (),
_ => { _ => {
println!("{:?}", err); println!("{err:?}");
bail!("Wrong error") bail!("Wrong error")
} }
}, },
@@ -154,13 +154,9 @@ pub async fn init_lnd_client() -> LndClient {
let lnd_dir = get_lnd_dir("one"); let lnd_dir = get_lnd_dir("one");
let cert_file = lnd_dir.join("tls.cert"); let cert_file = lnd_dir.join("tls.cert");
let macaroon_file = lnd_dir.join("data/chain/bitcoin/regtest/admin.macaroon"); let macaroon_file = lnd_dir.join("data/chain/bitcoin/regtest/admin.macaroon");
LndClient::new( LndClient::new(format!("https://{LND_RPC_ADDR}"), cert_file, macaroon_file)
format!("https://{}", LND_RPC_ADDR), .await
cert_file, .unwrap()
macaroon_file,
)
.await
.unwrap()
} }
/// Pays a Bolt11Invoice if it's on the regtest network, otherwise returns Ok /// Pays a Bolt11Invoice if it's on the regtest network, otherwise returns Ok

View File

@@ -70,8 +70,7 @@ impl Lnd {
// Validate cert_file exists and is not empty // Validate cert_file exists and is not empty
if !cert_file.exists() || cert_file.metadata().map(|m| m.len() == 0).unwrap_or(true) { if !cert_file.exists() || cert_file.metadata().map(|m| m.len() == 0).unwrap_or(true) {
return Err(Error::InvalidConfig(format!( return Err(Error::InvalidConfig(format!(
"LND certificate file not found or empty: {:?}", "LND certificate file not found or empty: {cert_file:?}"
cert_file
))); )));
} }
@@ -83,8 +82,7 @@ impl Lnd {
.unwrap_or(true) .unwrap_or(true)
{ {
return Err(Error::InvalidConfig(format!( return Err(Error::InvalidConfig(format!(
"LND macaroon file not found or empty: {:?}", "LND macaroon file not found or empty: {macaroon_file:?}"
macaroon_file
))); )));
} }

View File

@@ -74,7 +74,7 @@ async fn main() -> Result<()> {
let sqlx_filter = "sqlx=warn,hyper_util=warn,reqwest=warn"; let sqlx_filter = "sqlx=warn,hyper_util=warn,reqwest=warn";
let env_filter = EnvFilter::new(format!("{},{}", default_filter, sqlx_filter)); let env_filter = EnvFilter::new(format!("{default_filter},{sqlx_filter}"));
// Parse input // Parse input
tracing_subscriber::fmt().with_env_filter(env_filter).init(); tracing_subscriber::fmt().with_env_filter(env_filter).init();
@@ -141,7 +141,7 @@ async fn main() -> Result<()> {
println!("icon_url: {}", info.icon_url.unwrap_or("None".to_string())); println!("icon_url: {}", info.icon_url.unwrap_or("None".to_string()));
for url in info.urls { for url in info.urls {
println!("mint_url: {}", url); println!("mint_url: {url}");
} }
for contact in info.contact { for contact in info.contact {

View File

@@ -29,7 +29,7 @@ impl std::fmt::Debug for Info {
// Use a fallback approach that won't panic // Use a fallback approach that won't panic
let mnemonic_display = { let mnemonic_display = {
let hash = sha256::Hash::hash(self.mnemonic.clone().into_bytes().as_ref()); let hash = sha256::Hash::hash(self.mnemonic.clone().into_bytes().as_ref());
format!("<hashed: {}>", hash) format!("<hashed: {hash}>")
}; };
f.debug_struct("Info") f.debug_struct("Info")
@@ -76,7 +76,7 @@ impl std::str::FromStr for LnBackend {
"lnd" => Ok(LnBackend::Lnd), "lnd" => Ok(LnBackend::Lnd),
#[cfg(feature = "grpc-processor")] #[cfg(feature = "grpc-processor")]
"grpcprocessor" => Ok(LnBackend::GrpcProcessor), "grpcprocessor" => Ok(LnBackend::GrpcProcessor),
_ => Err(format!("Unknown Lightning backend: {}", s)), _ => Err(format!("Unknown Lightning backend: {s}")),
} }
} }
} }
@@ -195,7 +195,7 @@ impl std::str::FromStr for DatabaseEngine {
"sqlite" => Ok(DatabaseEngine::Sqlite), "sqlite" => Ok(DatabaseEngine::Sqlite),
#[cfg(feature = "redb")] #[cfg(feature = "redb")]
"redb" => Ok(DatabaseEngine::Redb), "redb" => Ok(DatabaseEngine::Redb),
_ => Err(format!("Unknown database engine: {}", s)), _ => Err(format!("Unknown database engine: {s}")),
} }
} }
} }

View File

@@ -82,8 +82,7 @@ async fn main() -> anyhow::Result<()> {
let tower_http = "tower_http=warn"; let tower_http = "tower_http=warn";
let env_filter = EnvFilter::new(format!( let env_filter = EnvFilter::new(format!(
"{},{},{},{},{}", "{default_filter},{sqlx_filter},{hyper_filter},{h2_filter},{tower_http}"
default_filter, sqlx_filter, hyper_filter, h2_filter, tower_http
)); ));
tracing_subscriber::fmt().with_env_filter(env_filter).init(); tracing_subscriber::fmt().with_env_filter(env_filter).init();
@@ -633,7 +632,7 @@ async fn main() -> anyhow::Result<()> {
mint.set_quote_ttl(QuoteTTL::new(10_000, 10_000)).await?; mint.set_quote_ttl(QuoteTTL::new(10_000, 10_000)).await?;
} }
let socket_addr = SocketAddr::from_str(&format!("{}:{}", listen_addr, listen_port))?; let socket_addr = SocketAddr::from_str(&format!("{listen_addr}:{listen_port}"))?;
let listener = tokio::net::TcpListener::bind(socket_addr).await?; let listener = tokio::net::TcpListener::bind(socket_addr).await?;

View File

@@ -46,8 +46,7 @@ async fn main() -> anyhow::Result<()> {
let rustls_filter = "rustls=warn"; let rustls_filter = "rustls=warn";
let env_filter = EnvFilter::new(format!( let env_filter = EnvFilter::new(format!(
"{},{},{},{},{}", "{default_filter},{sqlx_filter},{hyper_filter},{h2_filter},{rustls_filter}"
default_filter, sqlx_filter, hyper_filter, h2_filter, rustls_filter
)); ));
tracing_subscriber::fmt().with_env_filter(env_filter).init(); tracing_subscriber::fmt().with_env_filter(env_filter).init();

View File

@@ -34,7 +34,7 @@ pub struct PaymentProcessorClient {
impl PaymentProcessorClient { impl PaymentProcessorClient {
/// Payment Processor /// Payment Processor
pub async fn new(addr: &str, port: u16, tls_dir: Option<PathBuf>) -> anyhow::Result<Self> { pub async fn new(addr: &str, port: u16, tls_dir: Option<PathBuf>) -> anyhow::Result<Self> {
let addr = format!("{}:{}", addr, port); let addr = format!("{addr}:{port}");
let channel = if let Some(tls_dir) = tls_dir { let channel = if let Some(tls_dir) = tls_dir {
// TLS directory exists, configure TLS // TLS directory exists, configure TLS

View File

@@ -246,11 +246,10 @@ FROM mint
for table in &tables { for table in &tables {
let query = format!( let query = format!(
r#" r#"
UPDATE {} UPDATE {table}
SET mint_url = ? SET mint_url = ?
WHERE mint_url = ?; WHERE mint_url = ?;
"#, "#
table
); );
sqlx::query(&query) sqlx::query(&query)