chore: clippy (#2032)
This commit is contained in:
parent
0187bedd11
commit
a1d6b5e3f7
|
@ -1,5 +1,6 @@
|
||||||
// Code adapted from: https://github.com/althea-net/guac_rs/tree/master/web3/src/jsonrpc
|
// 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 ethers_core::types::U256;
|
||||||
use serde::{
|
use serde::{
|
||||||
de::{self, MapAccess, Unexpected, Visitor},
|
de::{self, MapAccess, Unexpected, Visitor},
|
||||||
|
@ -190,8 +191,10 @@ pub enum Authorization {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Authorization {
|
impl Authorization {
|
||||||
pub fn basic(username: impl Into<String>, password: impl Into<String>) -> Self {
|
pub fn basic(username: impl AsRef<str>, password: impl AsRef<str>) -> Self {
|
||||||
let auth_secret = base64::encode(username.into() + ":" + &password.into());
|
let username = username.as_ref();
|
||||||
|
let password = password.as_ref();
|
||||||
|
let auth_secret = general_purpose::STANDARD.encode(format!("{username}:{password}"));
|
||||||
Self::Basic(auth_secret)
|
Self::Basic(auth_secret)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue