diff --git a/crates/ilp-cli/src/interpreter.rs b/crates/ilp-cli/src/interpreter.rs index 41e857793..8304098e0 100644 --- a/crates/ilp-cli/src/interpreter.rs +++ b/crates/ilp-cli/src/interpreter.rs @@ -12,22 +12,22 @@ use url::Url; pub enum Error { // Custom errors #[error("Usage error")] - UsageErr(&'static str), + Usage(&'static str), #[error("Invalid protocol in URL: {0}")] - ProtocolErr(String), + Protocol(String), // Foreign errors #[error("Error sending HTTP request: {0}")] - SendErr(#[from] reqwest::Error), + Send(#[from] reqwest::Error), #[error("Error receving HTTP response from testnet: {0}")] - TestnetErr(reqwest::Error), + Testnet(reqwest::Error), #[error("Error altering URL scheme")] - SchemeErr(()), // TODO: should be part of UrlError, see https://github.com/servo/rust-url/issues/299 + Scheme(()), // TODO: should be part of UrlError, see https://github.com/servo/rust-url/issues/299 #[error("Error parsing URL: {0}")] - UrlErr(#[from] url::ParseError), + Url(#[from] url::ParseError), #[error("WebSocket error: {0}")] - WebsocketErr(#[from] tungstenite::error::Error), + Websocket(#[from] tungstenite::error::Error), #[error("HTTP error: {0}")] - HttpErr(#[from] http::Error), + Http(#[from] http::Error), } pub fn run(matches: &ArgMatches) -> Result { @@ -49,35 +49,35 @@ pub fn run(matches: &ArgMatches) -> Result { ("list", Some(submatches)) => client.get_accounts(submatches), ("update", Some(submatches)) => client.put_account(submatches), ("update-settings", Some(submatches)) => client.put_account_settings(submatches), - _ => Err(Error::UsageErr("ilp-cli help accounts")), + _ => Err(Error::Usage("ilp-cli help accounts")), }, ("pay", Some(pay_matches)) => client.post_account_payments(pay_matches), ("rates", Some(rates_matches)) => match rates_matches.subcommand() { ("list", Some(submatches)) => client.get_rates(submatches), ("set-all", Some(submatches)) => client.put_rates(submatches), - _ => Err(Error::UsageErr("ilp-cli help rates")), + _ => Err(Error::Usage("ilp-cli help rates")), }, ("routes", Some(routes_matches)) => match routes_matches.subcommand() { ("list", Some(submatches)) => client.get_routes(submatches), ("set", Some(submatches)) => client.put_route_static(submatches), ("set-all", Some(submatches)) => client.put_routes_static(submatches), - _ => Err(Error::UsageErr("ilp-cli help routes")), + _ => Err(Error::Usage("ilp-cli help routes")), }, ("settlement-engines", Some(settlement_matches)) => match settlement_matches.subcommand() { ("set-all", Some(submatches)) => client.put_settlement_engines(submatches), - _ => Err(Error::UsageErr("ilp-cli help settlement-engines")), + _ => Err(Error::Usage("ilp-cli help settlement-engines")), }, ("status", Some(status_matches)) => client.get_root(status_matches), ("logs", Some(log_level)) => client.put_tracing_level(log_level), ("testnet", Some(testnet_matches)) => match testnet_matches.subcommand() { ("setup", Some(submatches)) => client.xpring_account(submatches), - _ => Err(Error::UsageErr("ilp-cli help testnet")), + _ => Err(Error::Usage("ilp-cli help testnet")), }, ("payments", Some(payments_matches)) => match payments_matches.subcommand() { ("incoming", Some(submatches)) => client.ws_payments_incoming(submatches), - _ => Err(Error::UsageErr("ilp-cli help payments")), + _ => Err(Error::Usage("ilp-cli help payments")), }, - _ => Err(Error::UsageErr("ilp-cli help")), + _ => Err(Error::Usage("ilp-cli help")), } } @@ -95,7 +95,7 @@ impl NodeClient<'_> { .get(&format!("{}/accounts/{}/balance", self.url, user)) .bearer_auth(auth) .send() - .map_err(Error::SendErr) + .map_err(Error::Send) } // POST /accounts @@ -106,7 +106,7 @@ impl NodeClient<'_> { .bearer_auth(auth) .json(&args) .send() - .map_err(Error::SendErr) + .map_err(Error::Send) } // PUT /accounts/:username @@ -117,7 +117,7 @@ impl NodeClient<'_> { .bearer_auth(auth) .json(&args) .send() - .map_err(Error::SendErr) + .map_err(Error::Send) } // DELETE /accounts/:username @@ -127,7 +127,7 @@ impl NodeClient<'_> { .delete(&format!("{}/accounts/{}", self.url, args["username"])) .bearer_auth(auth) .send() - .map_err(Error::SendErr) + .map_err(Error::Send) } // WebSocket /accounts/:username/payments/incoming @@ -141,13 +141,13 @@ impl NodeClient<'_> { let scheme = match url.scheme() { "http" => Ok("ws"), "https" => Ok("wss"), - s => Err(Error::ProtocolErr(format!( + s => Err(Error::Protocol(format!( "{} (only HTTP and HTTPS are supported)", s ))), }?; - url.set_scheme(scheme).map_err(Error::SchemeErr)?; + url.set_scheme(scheme).map_err(Error::Scheme)?; let request: Request = Request::builder() .uri(url.into_string()) @@ -169,13 +169,13 @@ impl NodeClient<'_> { let scheme = match url.scheme() { "http" => Ok("ws"), "https" => Ok("wss"), - s => Err(Error::ProtocolErr(format!( + s => Err(Error::Protocol(format!( "{} (only HTTP and HTTPS are supported)", s ))), }?; - url.set_scheme(scheme).map_err(Error::SchemeErr)?; + url.set_scheme(scheme).map_err(Error::Scheme)?; let request: Request = Request::builder() .uri(url.into_string()) @@ -196,7 +196,7 @@ impl NodeClient<'_> { .get(&format!("{}/accounts/{}", self.url, args["username"])) .bearer_auth(auth) .send() - .map_err(Error::SendErr) + .map_err(Error::Send) } // GET /accounts @@ -206,7 +206,7 @@ impl NodeClient<'_> { .get(&format!("{}/accounts", self.url)) .bearer_auth(auth) .send() - .map_err(Error::SendErr) + .map_err(Error::Send) } // PUT /accounts/:username/settings @@ -218,7 +218,7 @@ impl NodeClient<'_> { .bearer_auth(auth) .json(&args) .send() - .map_err(Error::SendErr) + .map_err(Error::Send) } // POST /accounts/:username/payments @@ -230,7 +230,7 @@ impl NodeClient<'_> { .bearer_auth(auth) .json(&args) .send() - .map_err(Error::SendErr) + .map_err(Error::Send) } // GET /rates @@ -238,7 +238,7 @@ impl NodeClient<'_> { self.client .get(&format!("{}/rates", self.url)) .send() - .map_err(Error::SendErr) + .map_err(Error::Send) } // PUT /rates @@ -249,7 +249,7 @@ impl NodeClient<'_> { .bearer_auth(auth) .json(&rate_pairs) .send() - .map_err(Error::SendErr) + .map_err(Error::Send) } // GET /routes @@ -257,7 +257,7 @@ impl NodeClient<'_> { self.client .get(&format!("{}/routes", self.url)) .send() - .map_err(Error::SendErr) + .map_err(Error::Send) } // PUT /routes/static/:prefix @@ -268,7 +268,7 @@ impl NodeClient<'_> { .bearer_auth(auth) .body(args["destination"].to_string()) .send() - .map_err(Error::SendErr) + .map_err(Error::Send) } // PUT routes/static @@ -279,7 +279,7 @@ impl NodeClient<'_> { .bearer_auth(auth) .json(&route_pairs) .send() - .map_err(Error::SendErr) + .map_err(Error::Send) } // PUT /settlement/engines @@ -290,7 +290,7 @@ impl NodeClient<'_> { .bearer_auth(auth) .json(&engine_pairs) .send() - .map_err(Error::SendErr) + .map_err(Error::Send) } // PUT /tracing-level @@ -301,7 +301,7 @@ impl NodeClient<'_> { .bearer_auth(auth) .body(args["level"].to_owned()) .send() - .map_err(Error::SendErr) + .map_err(Error::Send) } // GET / @@ -309,7 +309,7 @@ impl NodeClient<'_> { self.client .get(&format!("{}/", self.url)) .send() - .map_err(Error::SendErr) + .map_err(Error::Send) } /* @@ -332,7 +332,7 @@ impl NodeClient<'_> { .get(&format!("https://xpring.io/api/accounts/{}", asset)) .send()? .json() - .map_err(Error::TestnetErr)?; + .map_err(Error::Testnet)?; let mut args = HashMap::new(); let token = format!("{}:{}", foreign_args.username, foreign_args.passkey); args.insert("ilp_over_http_url", foreign_args.http_endpoint); @@ -360,7 +360,7 @@ impl NodeClient<'_> { http::Response::builder().body(token).unwrap(), // infallible unwrap )) } else { - result.map_err(Error::SendErr) + result.map_err(Error::Send) } } } diff --git a/crates/ilp-cli/src/main.rs b/crates/ilp-cli/src/main.rs index ec8a0c524..3c9200714 100644 --- a/crates/ilp-cli/src/main.rs +++ b/crates/ilp-cli/src/main.rs @@ -14,7 +14,7 @@ pub fn main() { // 4. Handle interpreter output match result { - Err(interpreter::Error::UsageErr(s)) => { + Err(interpreter::Error::Usage(s)) => { // Clap doesn't seem to have a built-in way of manually printing the // help text for an arbitrary subcommand, but this works just the same. app.get_matches_from(s.split(' ')); @@ -217,9 +217,9 @@ mod interface_tests { Ok(matches) => match run(&matches) { // Because these are interface tests, not integration tests, network errors are expected Ok(_) - | Err(Error::SendErr(_)) - | Err(Error::WebsocketErr(_)) - | Err(Error::TestnetErr(_)) => (), + | Err(Error::Send(_)) + | Err(Error::Websocket(_)) + | Err(Error::Testnet(_)) => (), Err(e) => panic!("Unexpected interpreter failure: {}", e), }, } diff --git a/crates/ilp-node/src/main.rs b/crates/ilp-node/src/main.rs index 3dc06c27f..052c78dc7 100644 --- a/crates/ilp-node/src/main.rs +++ b/crates/ilp-node/src/main.rs @@ -376,7 +376,7 @@ fn set_app_env(env_config: &Config, app: &mut App<'_, '_>, path: &[String], dept if depth == 1 { for item in &mut app.p.opts { if let Ok(value) = env_config.get_str(&item.b.name.to_lowercase()) { - item.v.env = Some((&OsStr::new(item.b.name), Some(OsString::from(value)))); + item.v.env = Some((OsStr::new(item.b.name), Some(OsString::from(value)))); } } return; diff --git a/crates/ilp-node/src/node.rs b/crates/ilp-node/src/node.rs index 8564b1d85..17bfcc8d9 100644 --- a/crates/ilp-node/src/node.rs +++ b/crates/ilp-node/src/node.rs @@ -375,7 +375,7 @@ impl InterledgerNode { } Err(RejectBuilder { code: ErrorCode::F02_UNREACHABLE, - message: &format!( + message: format!( // TODO we might not want to expose the internal account ID in the error "No outgoing route for account: {} (ILP address of the Prepare packet: {})", request.to.id(), diff --git a/crates/interledger-api/src/routes/accounts.rs b/crates/interledger-api/src/routes/accounts.rs index aef4eb1af..011124aa8 100644 --- a/crates/interledger-api/src/routes/accounts.rs +++ b/crates/interledger-api/src/routes/accounts.rs @@ -415,7 +415,7 @@ where let server_secret_clone = server_secret.clone(); async move { if let Some(ref username) = default_spsp_account { - let id = store.get_account_id_from_username(&username).await?; + let id = store.get_account_id_from_username(username).await?; // TODO this shouldn't take multiple store calls let mut accounts = store.get_accounts(vec![id]).await?; diff --git a/crates/interledger-api/src/routes/node_settings.rs b/crates/interledger-api/src/routes/node_settings.rs index d03a0d958..72987a587 100644 --- a/crates/interledger-api/src/routes/node_settings.rs +++ b/crates/interledger-api/src/routes/node_settings.rs @@ -133,7 +133,7 @@ where // Convert the usernames to account IDs to set the routes in the store let mut usernames: Vec = Vec::new(); for username in routes.values() { - let user = match Username::from_str(&username) { + let user = match Username::from_str(username) { Ok(u) => u, Err(_) => return Err(Rejection::from(ApiError::bad_request())), }; diff --git a/crates/interledger-btp/src/packet.rs b/crates/interledger-btp/src/packet.rs index 0e6890aeb..3927673e6 100644 --- a/crates/interledger-btp/src/packet.rs +++ b/crates/interledger-btp/src/packet.rs @@ -568,7 +568,7 @@ mod tests { #[test] fn from_bytes() { assert_eq!( - BtpMessage::from_bytes(&MESSAGE_1_SERIALIZED).unwrap(), + BtpMessage::from_bytes(MESSAGE_1_SERIALIZED).unwrap(), *MESSAGE_1 ); } @@ -597,7 +597,7 @@ mod tests { #[test] fn from_bytes() { assert_eq!( - BtpResponse::from_bytes(&RESPONSE_1_SERIALIZED).unwrap(), + BtpResponse::from_bytes(RESPONSE_1_SERIALIZED).unwrap(), *RESPONSE_1 ); } @@ -625,7 +625,7 @@ mod tests { #[test] fn from_bytes() { - assert_eq!(BtpError::from_bytes(&ERROR_1_SERIALIZED).unwrap(), *ERROR_1); + assert_eq!(BtpError::from_bytes(ERROR_1_SERIALIZED).unwrap(), *ERROR_1); } #[test] diff --git a/crates/interledger-btp/src/server.rs b/crates/interledger-btp/src/server.rs index c5eb2e5ca..8d3e7efc5 100644 --- a/crates/interledger-btp/src/server.rs +++ b/crates/interledger-btp/src/server.rs @@ -113,7 +113,7 @@ where let (auth, mut connection) = get_auth(Box::pin(connection)).await?; debug!("Got BTP connection for username: {}", username); let account = store - .get_account_from_btp_auth(&username, &auth.token.expose_secret()) + .get_account_from_btp_auth(&username, auth.token.expose_secret()) .map_err(move |_| warn!("BTP connection does not correspond to an account")) .await?; diff --git a/crates/interledger-ccp/src/server.rs b/crates/interledger-ccp/src/server.rs index fb59c7e06..71ad82722 100644 --- a/crates/interledger-ccp/src/server.rs +++ b/crates/interledger-ccp/src/server.rs @@ -439,7 +439,7 @@ where warn!("Error handling incoming Route Update request, sending a Route Control request to get updated routing table info from peer. Error was: {}", &message); let reject = RejectBuilder { code: ErrorCode::F00_BAD_REQUEST, - message: &message.as_bytes(), + message: message.as_bytes(), data: &[], triggered_by: Some(&self.ilp_address.read()), } diff --git a/crates/interledger-http/src/server.rs b/crates/interledger-http/src/server.rs index 0296203a1..7a16ff536 100644 --- a/crates/interledger-http/src/server.rs +++ b/crates/interledger-http/src/server.rs @@ -43,7 +43,7 @@ where } Ok(store .get_account_from_http_auth( - &path_username, + path_username, &password.expose_secret()[BEARER_TOKEN_START..], ) .await?) diff --git a/crates/interledger-ildcp/src/server.rs b/crates/interledger-ildcp/src/server.rs index 7821b70ea..3f4eaa0cd 100644 --- a/crates/interledger-ildcp/src/server.rs +++ b/crates/interledger-ildcp/src/server.rs @@ -37,7 +37,7 @@ where if is_ildcp_request(&request.prepare) { let from = request.from.ilp_address(); let builder = IldcpResponseBuilder { - ilp_address: &from, + ilp_address: from, asset_code: request.from.asset_code(), asset_scale: request.from.asset_scale(), }; diff --git a/crates/interledger-packet/src/address.rs b/crates/interledger-packet/src/address.rs index e4d28ab19..69eb0e632 100644 --- a/crates/interledger-packet/src/address.rs +++ b/crates/interledger-packet/src/address.rs @@ -161,7 +161,7 @@ impl Address { unsafe { self.0 .split(|&b| b == b'.') - .map(|s| str::from_utf8_unchecked(&s)) + .map(|s| str::from_utf8_unchecked(s)) } } diff --git a/crates/interledger-packet/src/fixtures.rs b/crates/interledger-packet/src/fixtures.rs index 3c717ab28..736012e11 100644 --- a/crates/interledger-packet/src/fixtures.rs +++ b/crates/interledger-packet/src/fixtures.rs @@ -15,7 +15,7 @@ pub static PREPARE_BUILDER: Lazy> = Lazy::new(|| Prepare destination: Address::from_str("example.alice").unwrap(), expires_at: *EXPIRES_AT, execution_condition: &EXECUTION_CONDITION, - data: &DATA, + data: DATA, }); pub static EXPIRES_AT: Lazy = Lazy::new(|| { DateTime::parse_from_rfc3339("2018-06-07T20:48:42.483Z") @@ -54,7 +54,7 @@ pub static EXECUTION_CONDITION: [u8; 32] = *b"\ pub static FULFILL: Lazy = Lazy::new(|| FULFILL_BUILDER.build()); pub static FULFILL_BUILDER: Lazy> = Lazy::new(|| FulfillBuilder { fulfillment: &FULFILLMENT, - data: &DATA, + data: DATA, }); pub static FULFILL_BYTES: &[u8] = b"\ @@ -89,7 +89,7 @@ pub static REJECT_BUILDER: Lazy> = Lazy::new(|| RejectBui code: ErrorCode::F99_APPLICATION_ERROR, message: b"Some error", triggered_by: Some(&EXAMPLE_CONNECTOR), - data: &DATA, + data: DATA, }); pub static REJECT_BYTES: &[u8] = b"\ diff --git a/crates/interledger-packet/src/oer.rs b/crates/interledger-packet/src/oer.rs index fca2c6ffe..99e4d4690 100644 --- a/crates/interledger-packet/src/oer.rs +++ b/crates/interledger-packet/src/oer.rs @@ -370,9 +370,9 @@ mod test_buf_oer_ext { fn test_peek_var_octet_string() { let tests: &[(&[u8], &[u8])] = &[ (&[0x00], &[]), - (&ZERO_LENGTH_VARSTR, &[]), - (&ONE_BYTE_VARSTR, &[0x01]), - (&TWO_BYTE_VARSTR, &[0x01, 0x02]), + (ZERO_LENGTH_VARSTR, &[]), + (ONE_BYTE_VARSTR, &[0x01]), + (TWO_BYTE_VARSTR, &[0x01, 0x02]), (&SIZE_128_VARSTR, &[0; 128][..]), (&SIZE_5678_VARSTR, &[0; 5678][..]), ]; @@ -672,7 +672,7 @@ mod buf_mut_oer_ext { let long_varstr = &[0x00; 256][..]; let long_buffer = { let mut buffer = vec![0x82, 0x01, 0x00]; - buffer.extend_from_slice(&long_varstr); + buffer.extend_from_slice(long_varstr); buffer }; diff --git a/crates/interledger-packet/src/packet.rs b/crates/interledger-packet/src/packet.rs index a6a05041f..e1a585c88 100644 --- a/crates/interledger-packet/src/packet.rs +++ b/crates/interledger-packet/src/packet.rs @@ -161,7 +161,7 @@ impl TryFrom for Prepare { let expires_at = str::from_utf8(&read_expires_at[..]) .expect("read_expires_at matches only ascii, utf8 conversion must succeed"); let expires_at: DateTime = - Utc.datetime_from_str(&expires_at, INTERLEDGER_TIMESTAMP_FORMAT)?; + Utc.datetime_from_str(expires_at, INTERLEDGER_TIMESTAMP_FORMAT)?; let expires_at = SystemTime::from(expires_at); #[cfg(feature = "roundtrip-only")] @@ -279,7 +279,7 @@ impl fmt::Debug for Prepare { ) .field( "execution_condition", - &HexString(&self.execution_condition()), + &HexString(self.execution_condition()), ) .field("data_length", &self.data().len()) .finish() diff --git a/crates/interledger-router/src/router.rs b/crates/interledger-router/src/router.rs index 7aa2855f0..2476bf4da 100644 --- a/crates/interledger-router/src/router.rs +++ b/crates/interledger-router/src/router.rs @@ -68,7 +68,7 @@ where } else if !routing_table.is_empty() { let mut matching_prefix = ""; let routing_table = self.store.routing_table(); - for (ref prefix, account) in (*routing_table).iter() { + for (prefix, account) in (*routing_table).iter() { // Check if the route prefix matches or is empty (meaning it's a catch-all address) if (prefix.is_empty() || dest.starts_with(prefix.as_str())) && prefix.len() >= matching_prefix.len() diff --git a/crates/interledger-service-util/src/echo_service.rs b/crates/interledger-service-util/src/echo_service.rs index 0eba9bcac..b552e0d8f 100644 --- a/crates/interledger-service-util/src/echo_service.rs +++ b/crates/interledger-service-util/src/echo_service.rs @@ -288,11 +288,7 @@ mod echo_tests { assert_eq!(request.prepare.execution_condition(), execution_condition); assert_eq!(request.prepare.destination(), destination); assert_eq!(request.prepare.data(), &data[..]); - Ok(FulfillBuilder { - fulfillment: &fulfillment, - data, - } - .build()) + Ok(FulfillBuilder { fulfillment, data }.build()) }); let mut echo_service = EchoService::new(TestStore(node_address), handler); @@ -335,7 +331,7 @@ mod echo_tests { assert_eq!(request.prepare.destination(), dest); assert_eq!(request.prepare.data(), &data[..]); Ok(FulfillBuilder { - fulfillment: &fulfillment, + fulfillment, data: &[], } .build()) @@ -380,11 +376,7 @@ mod echo_tests { assert_eq!(request.prepare.execution_condition(), execution_condition); assert_eq!(request.prepare.destination(), source_address); assert_eq!(request.prepare.data(), &data[..]); - Ok(FulfillBuilder { - fulfillment: &fulfillment, - data, - } - .build()) + Ok(FulfillBuilder { fulfillment, data }.build()) }); let mut echo_service = EchoService::new(TestStore(node_address), handler); diff --git a/crates/interledger-service-util/src/exchange_rates_service.rs b/crates/interledger-service-util/src/exchange_rates_service.rs index 9569bb74c..a82087fda 100644 --- a/crates/interledger-service-util/src/exchange_rates_service.rs +++ b/crates/interledger-service-util/src/exchange_rates_service.rs @@ -55,7 +55,7 @@ where (1f64, 1f64) } else if let Ok(rates) = self .store - .get_exchange_rates(&[&request.from.asset_code(), &request.to.asset_code()]) + .get_exchange_rates(&[request.from.asset_code(), request.to.asset_code()]) { // Exchange rates are expressed as `base asset / asset`. To calculate the outgoing amount, // we multiply by the incoming asset's rate and divide by the outgoing asset's rate. For example, diff --git a/crates/interledger-spsp/src/client.rs b/crates/interledger-spsp/src/client.rs index cdd98eb6d..bafca1fe2 100644 --- a/crates/interledger-spsp/src/client.rs +++ b/crates/interledger-spsp/src/client.rs @@ -69,7 +69,7 @@ where } fn payment_pointer_to_url(payment_pointer: &str) -> String { - let mut url: String = if let Some(suffix) = payment_pointer.strip_prefix("$") { + let mut url: String = if let Some(suffix) = payment_pointer.strip_prefix('$') { let prefix = "https://"; let mut url = String::with_capacity(prefix.len() + suffix.len()); url.push_str(prefix); diff --git a/crates/interledger-store/src/account.rs b/crates/interledger-store/src/account.rs index 2c0d137ca..38ec2e9c9 100644 --- a/crates/interledger-store/src/account.rs +++ b/crates/interledger-store/src/account.rs @@ -184,25 +184,25 @@ impl Account { if let Some(ref token) = self.ilp_over_btp_outgoing_token { self.ilp_over_btp_outgoing_token = Some(SecretBytesMut::from(encrypt_token( encryption_key, - &token.expose_secret(), + token.expose_secret(), ))); } if let Some(ref token) = self.ilp_over_http_outgoing_token { self.ilp_over_http_outgoing_token = Some(SecretBytesMut::from(encrypt_token( encryption_key, - &token.expose_secret(), + token.expose_secret(), ))); } if let Some(ref token) = self.ilp_over_btp_incoming_token { self.ilp_over_btp_incoming_token = Some(SecretBytesMut::from(encrypt_token( encryption_key, - &token.expose_secret(), + token.expose_secret(), ))); } if let Some(ref token) = self.ilp_over_http_incoming_token { self.ilp_over_http_incoming_token = Some(SecretBytesMut::from(encrypt_token( encryption_key, - &token.expose_secret(), + token.expose_secret(), ))); } AccountWithEncryptedTokens { account: self } @@ -220,7 +220,7 @@ impl AccountWithEncryptedTokens { pub fn decrypt_tokens(mut self, decryption_key: &aead::LessSafeKey) -> Account { if let Some(ref encrypted) = self.account.ilp_over_btp_outgoing_token { self.account.ilp_over_btp_outgoing_token = - decrypt_token(decryption_key, &encrypted.expose_secret()) + decrypt_token(decryption_key, encrypted.expose_secret()) .map_err(|_| { error!( "Unable to decrypt ilp_over_btp_outgoing_token for account {}", @@ -231,7 +231,7 @@ impl AccountWithEncryptedTokens { } if let Some(ref encrypted) = self.account.ilp_over_http_outgoing_token { self.account.ilp_over_http_outgoing_token = - decrypt_token(decryption_key, &encrypted.expose_secret()) + decrypt_token(decryption_key, encrypted.expose_secret()) .map_err(|_| { error!( "Unable to decrypt ilp_over_http_outgoing_token for account {}", @@ -242,7 +242,7 @@ impl AccountWithEncryptedTokens { } if let Some(ref encrypted) = self.account.ilp_over_btp_incoming_token { self.account.ilp_over_btp_incoming_token = - decrypt_token(decryption_key, &encrypted.expose_secret()) + decrypt_token(decryption_key, encrypted.expose_secret()) .map_err(|_| { error!( "Unable to decrypt ilp_over_btp_incoming_token for account {}", @@ -253,7 +253,7 @@ impl AccountWithEncryptedTokens { } if let Some(ref encrypted) = self.account.ilp_over_http_incoming_token { self.account.ilp_over_http_incoming_token = - decrypt_token(decryption_key, &encrypted.expose_secret()) + decrypt_token(decryption_key, encrypted.expose_secret()) .map_err(|_| { error!( "Unable to decrypt ilp_over_http_incoming_token for account {}", diff --git a/crates/interledger-store/src/redis/mod.rs b/crates/interledger-store/src/redis/mod.rs index 3aa85e064..6b45b6dcf 100644 --- a/crates/interledger-store/src/redis/mod.rs +++ b/crates/interledger-store/src/redis/mod.rs @@ -304,7 +304,7 @@ impl RedisStoreBuilder { sub_connection.psubscribe::<_, _, Vec>(&[prefix], move |msg| { let channel_name = msg.get_channel_name(); if let Some(suffix) = channel_name.strip_prefix(&db_prefix) { - if let Ok(account_id) = Uuid::from_str(&suffix) { + if let Ok(account_id) = Uuid::from_str(suffix) { let message: PaymentNotification = match serde_json::from_slice(msg.get_payload_bytes()) { Ok(s) => s, Err(e) => { @@ -1461,7 +1461,7 @@ impl CcpRoutingStore for RedisStore { let account_ids: Vec = account_ids .into_iter() .map(|id| id.0) - .filter(|id| !ignore_accounts.contains(&id)) + .filter(|id| !ignore_accounts.contains(id)) .collect(); if account_ids.is_empty() { return Ok(Vec::new()); @@ -2010,7 +2010,7 @@ impl FromStr for RedisAccountId { type Err = uuid::Error; fn from_str(src: &str) -> Result { - let id = Uuid::from_str(&src)?; + let id = Uuid::from_str(src)?; Ok(RedisAccountId(id)) } } @@ -2206,7 +2206,7 @@ fn get_value(key: &str, map: &HashMap) -> Result(key: &str, map: &HashMap) -> Result