Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

chore: clippy #2032

Merged
merged 1 commit into from
Jan 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ethers-providers/src/transports/common.rs
Original file line number Diff line number Diff line change
@@ -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},
Expand Down Expand Up @@ -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)
}

Expand Down