mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-02-23 04:52:28 +00:00
fix some lints
This commit is contained in:
parent
b807ae2796
commit
002cfb1b4d
7 changed files with 18 additions and 9 deletions
|
@ -254,6 +254,8 @@ pub fn endpoint_ident(fn_ident: &Ident) -> Ident {
|
||||||
format_ident!("{}___gotham_restful_endpoint", fn_ident)
|
format_ident!("{}___gotham_restful_endpoint", fn_ident)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clippy doesn't realize that vectors can be used in closures
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::needless_collect))]
|
||||||
fn expand_endpoint_type(ty: EndpointType, attrs: AttributeArgs, fun: &ItemFn) -> Result<TokenStream> {
|
fn expand_endpoint_type(ty: EndpointType, attrs: AttributeArgs, fun: &ItemFn) -> Result<TokenStream> {
|
||||||
// reject unsafe functions
|
// reject unsafe functions
|
||||||
if let Some(unsafety) = fun.sig.unsafety {
|
if let Some(unsafety) = fun.sig.unsafety {
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
#![warn(missing_debug_implementations, rust_2018_idioms)]
|
||||||
|
#![deny(broken_intra_doc_links)]
|
||||||
|
#![forbid(unsafe_code)]
|
||||||
|
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
use proc_macro2::TokenStream as TokenStream2;
|
use proc_macro2::TokenStream as TokenStream2;
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
|
|
|
@ -86,6 +86,9 @@ pub(crate) fn expand_private_openapi_trait(mut attrs: AttributeArgs, tr8: ItemTr
|
||||||
let attrs = TraitItemAttrs::parse(method.attrs)?;
|
let attrs = TraitItemAttrs::parse(method.attrs)?;
|
||||||
method.attrs = attrs.other_attrs;
|
method.attrs = attrs.other_attrs;
|
||||||
for bound in attrs.non_openapi_bound {
|
for bound in attrs.non_openapi_bound {
|
||||||
|
// we compare two incompatible types using their `Display` implementation
|
||||||
|
// this triggers a false positive in clippy
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cmp_owned))]
|
||||||
method
|
method
|
||||||
.sig
|
.sig
|
||||||
.generics
|
.generics
|
||||||
|
@ -129,6 +132,9 @@ pub(crate) fn expand_private_openapi_trait(mut attrs: AttributeArgs, tr8: ItemTr
|
||||||
let attrs = TraitItemAttrs::parse(method.attrs)?;
|
let attrs = TraitItemAttrs::parse(method.attrs)?;
|
||||||
method.attrs = attrs.other_attrs;
|
method.attrs = attrs.other_attrs;
|
||||||
for bound in attrs.openapi_bound {
|
for bound in attrs.openapi_bound {
|
||||||
|
// we compare two incompatible types using their `Display` implementation
|
||||||
|
// this triggers a false positive in clippy
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cmp_owned))]
|
||||||
method
|
method
|
||||||
.sig
|
.sig
|
||||||
.generics
|
.generics
|
||||||
|
|
|
@ -12,7 +12,7 @@ use syn::{
|
||||||
struct MimeList(Punctuated<Path, Token![,]>);
|
struct MimeList(Punctuated<Path, Token![,]>);
|
||||||
|
|
||||||
impl Parse for MimeList {
|
impl Parse for MimeList {
|
||||||
fn parse(input: ParseStream) -> Result<Self> {
|
fn parse(input: ParseStream<'_>) -> Result<Self> {
|
||||||
let list = Punctuated::parse_separated_nonempty(&input)?;
|
let list = Punctuated::parse_separated_nonempty(&input)?;
|
||||||
Ok(Self(list))
|
Ok(Self(list))
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ use syn::{
|
||||||
struct MethodList(Punctuated<Ident, Token![,]>);
|
struct MethodList(Punctuated<Ident, Token![,]>);
|
||||||
|
|
||||||
impl Parse for MethodList {
|
impl Parse for MethodList {
|
||||||
fn parse(input: ParseStream) -> Result<Self> {
|
fn parse(input: ParseStream<'_>) -> Result<Self> {
|
||||||
let content;
|
let content;
|
||||||
let _paren = parenthesized!(content in input);
|
let _paren = parenthesized!(content in input);
|
||||||
let list = Punctuated::parse_separated_nonempty(&content)?;
|
let list = Punctuated::parse_separated_nonempty(&content)?;
|
||||||
|
|
|
@ -112,6 +112,7 @@ To change settings, you need to put this type into gotham's [State]:
|
||||||
```rust,no_run
|
```rust,no_run
|
||||||
# use gotham::{router::builder::*, pipeline::{new_pipeline, single::single_pipeline}, state::State};
|
# use gotham::{router::builder::*, pipeline::{new_pipeline, single::single_pipeline}, state::State};
|
||||||
# use gotham_restful::{*, cors::Origin};
|
# use gotham_restful::{*, cors::Origin};
|
||||||
|
# #[cfg_attr(feature = "cargo-clippy", allow(clippy::needless_doctest_main))]
|
||||||
fn main() {
|
fn main() {
|
||||||
let cors = CorsConfig {
|
let cors = CorsConfig {
|
||||||
origin: Origin::Star,
|
origin: Origin::Star,
|
||||||
|
|
10
src/lib.rs
10
src/lib.rs
|
@ -1,12 +1,8 @@
|
||||||
#![allow(clippy::tabs_in_doc_comments)]
|
#![warn(missing_debug_implementations, rust_2018_idioms)]
|
||||||
#![warn(
|
|
||||||
missing_debug_implementations,
|
|
||||||
rust_2018_idioms,
|
|
||||||
clippy::wildcard_imports,
|
|
||||||
clippy::redundant_closure_for_method_calls
|
|
||||||
)]
|
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(broken_intra_doc_links)]
|
||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
|
// can we have a lint for spaces in doc comments please?
|
||||||
|
#![cfg_attr(feature = "cargo-clippy", allow(clippy::tabs_in_doc_comments))]
|
||||||
/*!
|
/*!
|
||||||
This crate is an extension to the popular [gotham web framework][gotham] for Rust. It allows you to
|
This crate is an extension to the popular [gotham web framework][gotham] for Rust. It allows you to
|
||||||
create resources with assigned endpoints that aim to be a more convenient way of creating handlers
|
create resources with assigned endpoints that aim to be a more convenient way of creating handlers
|
||||||
|
|
Loading…
Add table
Reference in a new issue