Skip to content

Commit 2b5da9b

Browse files
committed
chore(fmt): cargo fmt with 1.85 and 2024
1 parent 465e105 commit 2b5da9b

9 files changed

Lines changed: 25 additions & 31 deletions

File tree

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ members = ["httpsig", "httpsig-hyper"]
33
resolver = "2"
44

55
[workspace.package]
6-
edition = "2021"
6+
edition = "2024"
77
version = "0.0.24"
88
authors = ["Jun Kurihara"]
99
homepage = "https://github.com/junkurihara/httpsig-rs"
1010
repository = "https://github.com/junkurihara/httpsig-rs"
1111
readme = "README.md"
1212
license = "MIT"
13-
rust-version = "1.75.0"
13+
rust-version = "1.85.0"
1414
categories = [
1515
"web-programming",
1616
"cryptography",

httpsig-hyper/src/hyper_content_digest.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
use super::{ContentDigestType, CONTENT_DIGEST_HEADER};
1+
use super::{CONTENT_DIGEST_HEADER, ContentDigestType};
22
use crate::error::{HyperDigestError, HyperDigestResult};
3-
use base64::{engine::general_purpose, Engine as _};
3+
use base64::{Engine as _, engine::general_purpose};
44
use bytes::Bytes;
55
use http::{Request, Response};
66
use http_body::Body;
7-
use http_body_util::{combinators::BoxBody, BodyExt, Full};
7+
use http_body_util::{BodyExt, Full, combinators::BoxBody};
88
use sha2::Digest;
99
use std::future::Future;
1010
use std::str::FromStr;

httpsig-hyper/src/hyper_http.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ use crate::error::{HyperSigError, HyperSigResult};
22
use http::{HeaderMap, Request, Response};
33
use http_body::Body;
44
use httpsig::prelude::{
5+
AlgorithmName, HttpSignatureBase, HttpSignatureHeaders, HttpSignatureHeadersMap, HttpSignatureParams, SigningKey, VerifyingKey,
56
message_component::{
67
DerivedComponentName, HttpMessageComponent, HttpMessageComponentId, HttpMessageComponentName, HttpMessageComponentParam,
78
},
8-
AlgorithmName, HttpSignatureBase, HttpSignatureHeaders, HttpSignatureHeadersMap, HttpSignatureParams, SigningKey, VerifyingKey,
99
};
1010
use indexmap::{IndexMap, IndexSet};
1111
use std::{future::Future, str::FromStr};
@@ -894,19 +894,17 @@ fn extract_derived_component<B>(
894894
DerivedComponentName::RequestTarget => match *req_or_res.method()? {
895895
http::Method::CONNECT => vec![req_or_res.uri()?.authority().map(|s| s.to_string()).unwrap_or("".to_string())],
896896
http::Method::OPTIONS => vec!["*".to_string()],
897-
_ => vec![req_or_res
898-
.uri()?
899-
.path_and_query()
900-
.map(|s| s.to_string())
901-
.unwrap_or("".to_string())],
897+
_ => vec![
898+
req_or_res
899+
.uri()?
900+
.path_and_query()
901+
.map(|s| s.to_string())
902+
.unwrap_or("".to_string()),
903+
],
902904
},
903905
DerivedComponentName::Path => vec![{
904906
let p = req_or_res.uri()?.path();
905-
if p.is_empty() {
906-
"/".to_string()
907-
} else {
908-
p.to_string()
909-
}
907+
if p.is_empty() { "/".to_string() } else { p.to_string() }
910908
}],
911909
DerivedComponentName::Query => vec![req_or_res.uri()?.query().map(|v| format!("?{v}")).unwrap_or("?".to_string())],
912910
DerivedComponentName::QueryParam => {

httpsig/src/crypto/asymmetric.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ use crate::{
44
trace::*,
55
};
66
use ecdsa::{
7-
elliptic_curve::{sec1::ToEncodedPoint, PublicKey as EcPublicKey, SecretKey as EcSecretKey},
7+
elliptic_curve::{PublicKey as EcPublicKey, SecretKey as EcSecretKey, sec1::ToEncodedPoint},
88
signature::{DigestSigner, DigestVerifier},
99
};
1010
use ed25519_compact::{PublicKey as Ed25519PublicKey, SecretKey as Ed25519SecretKey};
1111
use p256::NistP256;
1212
use p384::NistP384;
13-
use pkcs8::{der::Decode, Document, PrivateKeyInfo};
13+
use pkcs8::{Document, PrivateKeyInfo, der::Decode};
1414
use sha2::{Digest, Sha256, Sha384};
1515
use spki::SubjectPublicKeyInfoRef;
1616

1717
#[cfg(feature = "rsa-signature")]
1818
use rsa::{
19+
RsaPrivateKey, RsaPublicKey,
1920
pkcs1::{DecodeRsaPrivateKey, DecodeRsaPublicKey, EncodeRsaPublicKey},
2021
pkcs1v15, pss,
2122
signature::{Keypair, RandomizedSigner, SignatureEncoding, Verifier},
22-
RsaPrivateKey, RsaPublicKey,
2323
};
2424

2525
#[allow(non_upper_case_globals, dead_code)]
@@ -406,7 +406,7 @@ impl super::VerifyingKey for PublicKey {
406406
/// - For Ed25519 keys, use the raw 32-byte public key.
407407
/// - For RSA keys, use the DER encoding of the RSAPublicKey structure in PKCS#1 format.
408408
fn key_id(&self) -> String {
409-
use base64::{engine::general_purpose, Engine as _};
409+
use base64::{Engine as _, engine::general_purpose};
410410

411411
let bytes = match self {
412412
Self::EcdsaP256Sha256(vk) => vk.to_encoded_point(true).as_bytes().to_vec(),

httpsig/src/crypto/symmetric.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::{
33
error::{HttpSigError, HttpSigResult},
44
trace::*,
55
};
6-
use base64::{engine::general_purpose, Engine as _};
6+
use base64::{Engine as _, engine::general_purpose};
77
use hmac::{Hmac, Mac};
88
use sha2::{Digest, Sha256};
99

httpsig/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub mod prelude {
3232
#[cfg(test)]
3333
mod tests {
3434
use super::prelude::*;
35-
use base64::{engine::general_purpose, Engine as _};
35+
use base64::{Engine as _, engine::general_purpose};
3636

3737
/* ----------------------------------------------------------------- */
3838
// params from https://datatracker.ietf.org/doc/html/rfc9421#name-signing-a-request-using-ed2

httpsig/src/message_component/component.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::{
22
component_id::HttpMessageComponentId,
33
component_name::{DerivedComponentName, HttpMessageComponentName},
4-
component_param::{handle_params_key_into, handle_params_sf, HttpMessageComponentParam},
4+
component_param::{HttpMessageComponentParam, handle_params_key_into, handle_params_sf},
55
component_value::HttpMessageComponentValue,
66
};
77
use crate::{

httpsig/src/signature_base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ use crate::{
22
crypto::SigningKey,
33
error::{HttpSigError, HttpSigResult},
44
message_component::HttpMessageComponent,
5-
prelude::{message_component::HttpMessageComponentId, VerifyingKey},
5+
prelude::{VerifyingKey, message_component::HttpMessageComponentId},
66
signature_params::HttpSignatureParams,
77
};
8-
use base64::{engine::general_purpose, Engine as _};
8+
use base64::{Engine as _, engine::general_purpose};
99
use indexmap::IndexMap;
1010
use rustc_hash::FxBuildHasher;
1111
use sfv::{BareItem, Item, ListEntry, Parser};

httpsig/src/signature_params.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::{
55
trace::*,
66
util::has_unique_elements,
77
};
8-
use base64::{engine::general_purpose, Engine as _};
8+
use base64::{Engine as _, engine::general_purpose};
99
use rand::RngExt;
1010
use sfv::{FieldType, ListEntry, Parser};
1111
use std::time::{SystemTime, UNIX_EPOCH};
@@ -123,11 +123,7 @@ impl HttpSignatureParams {
123123
impl std::fmt::Display for HttpSignatureParams {
124124
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
125125
let joined = self.covered_components.iter().fold("".to_string(), |acc, v| {
126-
if acc.is_empty() {
127-
v.to_string()
128-
} else {
129-
format!("{acc} {v}")
130-
}
126+
if acc.is_empty() { v.to_string() } else { format!("{acc} {v}") }
131127
});
132128
let mut s: String = format!("({})", joined);
133129
if self.created.is_some() {

0 commit comments

Comments
 (0)