chore: fix rustfmt error
This commit is contained in:
@@ -18,8 +18,8 @@ use tokio::net::TcpListener;
|
||||
#[derive(Clone, Deserialize, Serialize, Validate, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "extra_protobuf", derive(prost::Message))]
|
||||
#[cfg_attr(
|
||||
feature = "typed_multipart",
|
||||
derive(axum_typed_multipart::TryFromMultipart)
|
||||
feature = "typed_multipart",
|
||||
derive(axum_typed_multipart::TryFromMultipart)
|
||||
)]
|
||||
pub struct ParametersGarde {
|
||||
#[garde(range(min = 5, max = 10))]
|
||||
@@ -76,13 +76,13 @@ async fn test_main() -> anyhow::Result<()> {
|
||||
.route(route::JSON, post(extract_json));
|
||||
|
||||
#[cfg(feature = "typed_header")]
|
||||
let router = router.route(
|
||||
let router = router.route(
|
||||
typed_header::route::TYPED_HEADER,
|
||||
post(typed_header::extract_typed_header),
|
||||
);
|
||||
|
||||
#[cfg(feature = "typed_multipart")]
|
||||
let router = router
|
||||
let router = router
|
||||
.route(
|
||||
typed_multipart::route::TYPED_MULTIPART,
|
||||
post(typed_multipart::extract_typed_multipart),
|
||||
@@ -93,7 +93,7 @@ async fn test_main() -> anyhow::Result<()> {
|
||||
);
|
||||
|
||||
#[cfg(feature = "extra")]
|
||||
let router = router
|
||||
let router = router
|
||||
.route(extra::route::CACHED, post(extra::extract_cached))
|
||||
.route(
|
||||
extra::route::WITH_REJECTION,
|
||||
@@ -105,34 +105,34 @@ async fn test_main() -> anyhow::Result<()> {
|
||||
);
|
||||
|
||||
#[cfg(feature = "extra_typed_path")]
|
||||
let router = router.route(
|
||||
let router = router.route(
|
||||
extra_typed_path::route::EXTRA_TYPED_PATH,
|
||||
get(extra_typed_path::extract_extra_typed_path),
|
||||
);
|
||||
|
||||
#[cfg(feature = "extra_query")]
|
||||
let router = router.route(
|
||||
let router = router.route(
|
||||
extra_query::route::EXTRA_QUERY,
|
||||
post(extra_query::extract_extra_query),
|
||||
);
|
||||
|
||||
#[cfg(feature = "extra_form")]
|
||||
let router = router.route(
|
||||
let router = router.route(
|
||||
extra_form::route::EXTRA_FORM,
|
||||
post(extra_form::extract_extra_form),
|
||||
);
|
||||
|
||||
#[cfg(feature = "extra_protobuf")]
|
||||
let router = router.route(
|
||||
let router = router.route(
|
||||
extra_protobuf::route::EXTRA_PROTOBUF,
|
||||
post(extra_protobuf::extract_extra_protobuf),
|
||||
);
|
||||
|
||||
#[cfg(feature = "yaml")]
|
||||
let router = router.route(yaml::route::YAML, post(yaml::extract_yaml));
|
||||
let router = router.route(yaml::route::YAML, post(yaml::extract_yaml));
|
||||
|
||||
#[cfg(feature = "msgpack")]
|
||||
let router = router
|
||||
let router = router
|
||||
.route(msgpack::route::MSGPACK, post(msgpack::extract_msgpack))
|
||||
.route(
|
||||
msgpack::route::MSGPACK_RAW,
|
||||
@@ -140,13 +140,13 @@ async fn test_main() -> anyhow::Result<()> {
|
||||
);
|
||||
|
||||
#[cfg(feature = "xml")]
|
||||
let router = router.route(xml::route::XML, post(xml::extract_xml));
|
||||
let router = router.route(xml::route::XML, post(xml::extract_xml));
|
||||
|
||||
#[cfg(feature = "toml")]
|
||||
let router = router.route(toml::route::TOML, post(toml::extract_toml));
|
||||
let router = router.route(toml::route::TOML, post(toml::extract_toml));
|
||||
|
||||
#[cfg(feature = "sonic")]
|
||||
let router = router.route(sonic::route::SONIC, post(sonic::extract_sonic));
|
||||
let router = router.route(sonic::route::SONIC, post(sonic::extract_sonic));
|
||||
|
||||
let router = router.with_state(MyState::default());
|
||||
|
||||
@@ -342,7 +342,7 @@ async fn test_main() -> anyhow::Result<()> {
|
||||
extra_typed_path_type_name,
|
||||
invalid_extra_typed_path_response,
|
||||
)
|
||||
.await;
|
||||
.await;
|
||||
println!("All {} tests passed.", extra_typed_path_type_name);
|
||||
Ok(())
|
||||
}
|
||||
@@ -562,9 +562,9 @@ mod typed_header {
|
||||
}
|
||||
|
||||
fn decode<'i, I>(values: &mut I) -> Result<Self, Error>
|
||||
where
|
||||
Self: Sized,
|
||||
I: Iterator<Item=&'i HeaderValue>,
|
||||
where
|
||||
Self: Sized,
|
||||
I: Iterator<Item = &'i HeaderValue>,
|
||||
{
|
||||
let value = values.next().ok_or_else(Error::invalid)?;
|
||||
let src = std::str::from_utf8(value.as_bytes()).map_err(|_| Error::invalid())?;
|
||||
@@ -683,8 +683,8 @@ mod extra {
|
||||
// 1.3. Implement your extractor (`FromRequestParts` or `FromRequest`)
|
||||
#[axum::async_trait]
|
||||
impl<S> FromRequestParts<S> for ParametersGarde
|
||||
where
|
||||
S: Send + Sync,
|
||||
where
|
||||
S: Send + Sync,
|
||||
{
|
||||
type Rejection = ParametersRejection;
|
||||
|
||||
@@ -964,7 +964,9 @@ mod sonic {
|
||||
pub const SONIC: &str = "/sonic";
|
||||
}
|
||||
|
||||
pub async fn extract_sonic(Garde(Sonic(parameters)): Garde<Sonic<ParametersGarde>>) -> StatusCode {
|
||||
pub async fn extract_sonic(
|
||||
Garde(Sonic(parameters)): Garde<Sonic<ParametersGarde>>,
|
||||
) -> StatusCode {
|
||||
validate_again(parameters, ())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user