mirror of
https://github.com/poem-web/poem.git
synced 2026-01-25 04:18:25 +00:00
clippy
This commit is contained in:
@@ -2,7 +2,7 @@ edition = "2021"
|
||||
newline_style = "unix"
|
||||
# comments
|
||||
normalize_comments = true
|
||||
#wrap_comments=true
|
||||
wrap_comments = true
|
||||
format_code_in_doc_comments = true
|
||||
# imports
|
||||
imports_granularity = "Crate"
|
||||
|
||||
@@ -40,8 +40,8 @@ impl<'a, T: Codec> GrpcServer<'a, T> {
|
||||
{
|
||||
let (parts, body) = request.into_parts();
|
||||
let mut resp = Response::default().set_content_type(T::CONTENT_TYPES[0]);
|
||||
let incoming_encoding =
|
||||
match get_incoming_encodings(&parts.headers, &self.accept_compressed) {
|
||||
let incoming_encoding = match get_incoming_encodings(&parts.headers, self.accept_compressed)
|
||||
{
|
||||
Ok(incoming_encoding) => incoming_encoding,
|
||||
Err(status) => {
|
||||
resp.headers_mut().extend(status.to_headers());
|
||||
@@ -88,8 +88,8 @@ impl<'a, T: Codec> GrpcServer<'a, T> {
|
||||
{
|
||||
let (parts, body) = request.into_parts();
|
||||
let mut resp = Response::default().set_content_type(T::CONTENT_TYPES[0]);
|
||||
let incoming_encoding =
|
||||
match get_incoming_encodings(&parts.headers, &self.accept_compressed) {
|
||||
let incoming_encoding = match get_incoming_encodings(&parts.headers, self.accept_compressed)
|
||||
{
|
||||
Ok(incoming_encoding) => incoming_encoding,
|
||||
Err(status) => {
|
||||
resp.headers_mut().extend(status.to_headers());
|
||||
@@ -132,8 +132,8 @@ impl<'a, T: Codec> GrpcServer<'a, T> {
|
||||
{
|
||||
let (parts, body) = request.into_parts();
|
||||
let mut resp = Response::default().set_content_type(T::CONTENT_TYPES[0]);
|
||||
let incoming_encoding =
|
||||
match get_incoming_encodings(&parts.headers, &self.accept_compressed) {
|
||||
let incoming_encoding = match get_incoming_encodings(&parts.headers, self.accept_compressed)
|
||||
{
|
||||
Ok(incoming_encoding) => incoming_encoding,
|
||||
Err(status) => {
|
||||
resp.headers_mut().extend(status.to_headers());
|
||||
@@ -179,8 +179,8 @@ impl<'a, T: Codec> GrpcServer<'a, T> {
|
||||
{
|
||||
let (parts, body) = request.into_parts();
|
||||
let mut resp = Response::default().set_content_type(T::CONTENT_TYPES[0]);
|
||||
let incoming_encoding =
|
||||
match get_incoming_encodings(&parts.headers, &self.accept_compressed) {
|
||||
let incoming_encoding = match get_incoming_encodings(&parts.headers, self.accept_compressed)
|
||||
{
|
||||
Ok(incoming_encoding) => incoming_encoding,
|
||||
Err(status) => {
|
||||
resp.headers_mut().extend(status.to_headers());
|
||||
|
||||
@@ -953,6 +953,7 @@ async fn hidden() {
|
||||
|
||||
#[test]
|
||||
fn issue_405() {
|
||||
#[allow(dead_code)]
|
||||
struct Api;
|
||||
|
||||
#[OpenApi]
|
||||
@@ -963,11 +964,13 @@ fn issue_405() {
|
||||
operation_id = "hello",
|
||||
transform = "my_transformer"
|
||||
)]
|
||||
#[allow(dead_code)]
|
||||
async fn index(&self) -> PlainText<String> {
|
||||
PlainText("hello, world!".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn my_transformer(ep: impl Endpoint) -> impl Endpoint {
|
||||
ep.map_to_response()
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ use poem_openapi::{
|
||||
#[tokio::test]
|
||||
async fn name() {
|
||||
#[Webhook]
|
||||
#[allow(dead_code)]
|
||||
trait MyWebhooks {
|
||||
#[oai(name = "a", method = "post")]
|
||||
fn test1(&self);
|
||||
@@ -28,6 +29,7 @@ async fn name() {
|
||||
#[tokio::test]
|
||||
async fn method() {
|
||||
#[Webhook]
|
||||
#[allow(dead_code)]
|
||||
trait MyWebhooks {
|
||||
#[oai(method = "post")]
|
||||
fn test1(&self);
|
||||
@@ -43,6 +45,7 @@ async fn method() {
|
||||
#[tokio::test]
|
||||
async fn deprecated() {
|
||||
#[Webhook]
|
||||
#[allow(dead_code)]
|
||||
trait MyWebhooks {
|
||||
#[oai(method = "post")]
|
||||
fn test1(&self);
|
||||
@@ -65,6 +68,7 @@ async fn tags() {
|
||||
}
|
||||
|
||||
#[Webhook(tag = "MyTags::A")]
|
||||
#[allow(dead_code)]
|
||||
trait MyWebhooks: Sync {
|
||||
#[oai(method = "post", tag = "MyTags::B", tag = "MyTags::C")]
|
||||
fn test1(&self);
|
||||
@@ -83,6 +87,7 @@ async fn tags() {
|
||||
#[tokio::test]
|
||||
async fn operation_id() {
|
||||
#[Webhook]
|
||||
#[allow(dead_code)]
|
||||
trait MyWebhooks {
|
||||
#[oai(method = "post", operation_id = "a")]
|
||||
fn test1(&self);
|
||||
@@ -104,6 +109,7 @@ async fn operation_id() {
|
||||
#[tokio::test]
|
||||
async fn parameters() {
|
||||
#[Webhook]
|
||||
#[allow(dead_code)]
|
||||
trait MyWebhooks {
|
||||
#[oai(method = "post")]
|
||||
fn test(&self, a: Query<i32>, b: Path<String>);
|
||||
@@ -139,6 +145,7 @@ async fn request_body() {
|
||||
#[Webhook]
|
||||
trait MyWebhooks {
|
||||
#[oai(method = "post")]
|
||||
#[allow(dead_code)]
|
||||
fn test(&self, req: Json<i32>);
|
||||
}
|
||||
|
||||
@@ -160,6 +167,7 @@ async fn response() {
|
||||
#[Webhook]
|
||||
trait MyWebhooks {
|
||||
#[oai(method = "post")]
|
||||
#[allow(dead_code)]
|
||||
fn test(&self) -> Json<i32>;
|
||||
}
|
||||
|
||||
@@ -184,6 +192,7 @@ async fn create() {
|
||||
#[Webhook]
|
||||
trait MyWebhooks {
|
||||
#[oai(method = "post")]
|
||||
#[allow(dead_code)]
|
||||
fn test(&self) -> Json<i32>;
|
||||
}
|
||||
|
||||
@@ -198,6 +207,7 @@ async fn external_docs() {
|
||||
method = "post",
|
||||
external_docs = "https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md"
|
||||
)]
|
||||
#[allow(dead_code)]
|
||||
fn test(&self);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,8 +117,7 @@ impl RequestBody {
|
||||
///
|
||||
/// - **Option<T>**
|
||||
///
|
||||
/// Extracts `T` from the incoming request, returns [`None`] if it
|
||||
/// fails.
|
||||
/// Extracts `T` from the incoming request, returns [`None`] if it fails.
|
||||
///
|
||||
/// - **&Request**
|
||||
///
|
||||
@@ -251,8 +250,7 @@ impl RequestBody {
|
||||
///
|
||||
/// - **Locale**
|
||||
///
|
||||
/// Extracts the [`Locale`](crate::i18n::Locale) from the incoming
|
||||
/// request.
|
||||
/// Extracts the [`Locale`](crate::i18n::Locale) from the incoming request.
|
||||
///
|
||||
/// - **StaticFileRequest**
|
||||
///
|
||||
@@ -357,7 +355,8 @@ pub trait FromRequest<'a>: Sized {
|
||||
/// - **&'static [u8]**
|
||||
///
|
||||
/// Sets the status to `OK` and the `Content-Type` to
|
||||
/// `application/octet-stream`. The slice is used as the body of the response.
|
||||
/// `application/octet-stream`. The slice is used as the body of the
|
||||
/// response.
|
||||
///
|
||||
/// - **Html<T>**
|
||||
///
|
||||
@@ -378,7 +377,8 @@ pub trait FromRequest<'a>: Sized {
|
||||
/// - **Bytes**
|
||||
///
|
||||
/// Sets the status to `OK` and the `Content-Type` to
|
||||
/// `application/octet-stream`. The bytes is used as the body of the response.
|
||||
/// `application/octet-stream`. The bytes is used as the body of the
|
||||
/// response.
|
||||
///
|
||||
/// - **Vec<u8>**
|
||||
///
|
||||
@@ -417,8 +417,8 @@ pub trait FromRequest<'a>: Sized {
|
||||
/// - **SSE**
|
||||
///
|
||||
/// Sets the status to `OK` and the `Content-Type` to `text/event-stream`
|
||||
/// with an event stream body. Use the [`SSE::new`](sse::SSE::new) function to
|
||||
/// create it.
|
||||
/// with an event stream body. Use the [`SSE::new`](sse::SSE::new) function
|
||||
/// to create it.
|
||||
///
|
||||
/// # Create you own response
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user