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))]
|
||||
@@ -564,7 +564,7 @@ mod typed_header {
|
||||
fn decode<'i, I>(values: &mut I) -> Result<Self, Error>
|
||||
where
|
||||
Self: Sized,
|
||||
I: Iterator<Item=&'i HeaderValue>,
|
||||
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())?;
|
||||
@@ -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, ())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,13 +23,13 @@ pub mod validify;
|
||||
#[cfg(feature = "yaml")]
|
||||
pub mod yaml;
|
||||
|
||||
mod sonic;
|
||||
#[cfg(feature = "toml")]
|
||||
pub mod toml;
|
||||
#[cfg(feature = "typed_multipart")]
|
||||
pub mod typed_multipart;
|
||||
#[cfg(feature = "xml")]
|
||||
pub mod xml;
|
||||
mod sonic;
|
||||
|
||||
use axum::http::StatusCode;
|
||||
use axum::response::{IntoResponse, Response};
|
||||
|
||||
@@ -19,8 +19,8 @@ use validator::{Validate, ValidateArgs, ValidationError};
|
||||
#[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 Parameters {
|
||||
#[validate(range(min = 5, max = 10))]
|
||||
@@ -34,8 +34,8 @@ pub struct Parameters {
|
||||
#[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 ParametersEx {
|
||||
#[validate(custom(function = "validate_v0", arg = "&'v_a RangeInclusive<i32>"))]
|
||||
@@ -828,7 +828,7 @@ mod typed_header {
|
||||
fn decode<'i, I>(values: &mut I) -> Result<Self, Error>
|
||||
where
|
||||
Self: Sized,
|
||||
I: Iterator<Item=&'i HeaderValue>,
|
||||
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())?;
|
||||
@@ -861,7 +861,7 @@ mod typed_header {
|
||||
fn decode<'i, I>(values: &mut I) -> Result<Self, Error>
|
||||
where
|
||||
Self: Sized,
|
||||
I: Iterator<Item=&'i HeaderValue>,
|
||||
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())?;
|
||||
|
||||
@@ -31,8 +31,8 @@ pub struct ParametersValidify {
|
||||
#[derive(Clone, Validify, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "extra_protobuf", derive(Message))]
|
||||
#[cfg_attr(
|
||||
feature = "typed_multipart",
|
||||
derive(axum_typed_multipart::TryFromMultipart)
|
||||
feature = "typed_multipart",
|
||||
derive(axum_typed_multipart::TryFromMultipart)
|
||||
)]
|
||||
pub struct ParametersValidifyWithoutPayload {
|
||||
#[validate(range(min = 5.0, max = 10.0))]
|
||||
@@ -1045,7 +1045,10 @@ async fn test_main() -> anyhow::Result<()> {
|
||||
.await?;
|
||||
// Modified
|
||||
test_executor
|
||||
.execute_modified::<Sonic<ParametersValidify>>(Method::POST, sonic::route::SONIC_MODIFIED)
|
||||
.execute_modified::<Sonic<ParametersValidify>>(
|
||||
Method::POST,
|
||||
sonic::route::SONIC_MODIFIED,
|
||||
)
|
||||
.await?;
|
||||
// Validified
|
||||
test_executor
|
||||
@@ -1056,7 +1059,10 @@ async fn test_main() -> anyhow::Result<()> {
|
||||
.await?;
|
||||
// ValidifiedByRef
|
||||
test_executor
|
||||
.execute::<Sonic<ParametersValidify>>(Method::POST, sonic::route::SONIC_VALIDIFIED_BY_REF)
|
||||
.execute::<Sonic<ParametersValidify>>(
|
||||
Method::POST,
|
||||
sonic::route::SONIC_VALIDIFIED_BY_REF,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
||||
@@ -1389,7 +1395,7 @@ mod typed_header {
|
||||
fn decode<'i, I>(values: &mut I) -> Result<Self, Error>
|
||||
where
|
||||
Self: Sized,
|
||||
I: Iterator<Item=&'i HeaderValue>,
|
||||
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())?;
|
||||
|
||||
Reference in New Issue
Block a user