chore: clippy (#2032)

This commit is contained in:
DaniPopes 2023-01-12 04:05:39 +01:00 committed by GitHub
parent 0187bedd11
commit a1d6b5e3f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -1,5 +1,6 @@
// Code adapted from: https://github.com/althea-net/guac_rs/tree/master/web3/src/jsonrpc
use base64::{engine::general_purpose, Engine};
use ethers_core::types::U256;
use serde::{
de::{self, MapAccess, Unexpected, Visitor},
@ -190,8 +191,10 @@ pub enum Authorization {
}
impl Authorization {
pub fn basic(username: impl Into<String>, password: impl Into<String>) -> Self {
let auth_secret = base64::encode(username.into() + ":" + &password.into());
pub fn basic(username: impl AsRef<str>, password: impl AsRef<str>) -> Self {
let username = username.as_ref();
let password = password.as_ref();
let auth_secret = general_purpose::STANDARD.encode(format!("{username}:{password}"));
Self::Basic(auth_secret)
}