Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
flaneur2020 committed Aug 8, 2024
1 parent 6ebdee1 commit 7471e3f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
8 changes: 2 additions & 6 deletions src/aws/credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,8 @@ impl AssumeRoleLoader {

let (mut parts, body) = req.into_parts();
self.sts_signer.sign(&mut parts, &source_cred)?;
let req =
reqwest::Request::try_from(http::Request::from_parts(parts, body)).or_else(|_| {
Err(anyhow!(
"failed to convert http::Request to reqwest::Request"
))
})?;
let req = reqwest::Request::try_from(http::Request::from_parts(parts, body))
.map_err(|_| anyhow!("failed to convert http::Request to reqwest::Request"))?;

let resp = self.client.execute(req).await?;
if resp.status() != http::StatusCode::OK {
Expand Down
4 changes: 2 additions & 2 deletions src/huaweicloud/obs/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ impl Signer {

fn build(
&self,
mut parts: &mut http::request::Parts,
parts: &mut http::request::Parts,
method: SigningMethod,
cred: &Credential,
) -> Result<SigningContext> {
let now = self.time.unwrap_or_else(now);
let mut ctx = SigningContext::build(&mut parts)?;
let mut ctx = SigningContext::build(parts)?;

let string_to_sign = string_to_sign(&mut ctx, cred, now, method, &self.bucket)?;
let signature =
Expand Down
8 changes: 4 additions & 4 deletions src/tencent/cos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,19 @@ impl Signer {
}

/// Signing request with header.
pub fn sign(&self, mut parts: &mut http::request::Parts, cred: &Credential) -> Result<()> {
let ctx = self.build(&mut parts, SigningMethod::Header, cred)?;
pub fn sign(&self, parts: &mut http::request::Parts, cred: &Credential) -> Result<()> {
let ctx = self.build(parts, SigningMethod::Header, cred)?;
ctx.apply(parts)
}

/// Signing request with query.
pub fn sign_query(
&self,
mut parts: &mut http::request::Parts,
parts: &mut http::request::Parts,
expire: Duration,
cred: &Credential,
) -> Result<()> {
let ctx = self.build(&mut parts, SigningMethod::Query(expire), cred)?;
let ctx = self.build(parts, SigningMethod::Query(expire), cred)?;
ctx.apply(parts)
}
}
Expand Down

0 comments on commit 7471e3f

Please sign in to comment.