Fix some hints from Rust and clippy
* the feature `proc_macro` has been stable since 1.29.0 and no longer requires an attribute to enable * https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#needless_return * https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#len_zero
This commit is contained in:
parent
c91b9137fb
commit
116a6f44bc
@ -181,7 +181,7 @@ impl ToTokens for Request {
|
||||
pub struct Request
|
||||
};
|
||||
|
||||
let request_struct_body = if self.fields.len() == 0 {
|
||||
let request_struct_body = if self.fields.is_empty() {
|
||||
quote!(;)
|
||||
} else {
|
||||
let fields = self.fields.iter().fold(TokenStream::new(), |mut field_tokens, request_field| {
|
||||
|
@ -15,7 +15,7 @@ impl Response {
|
||||
}
|
||||
|
||||
pub fn has_fields(&self) -> bool {
|
||||
self.fields.len() != 0
|
||||
!self.fields.is_empty()
|
||||
}
|
||||
|
||||
pub fn has_header_fields(&self) -> bool {
|
||||
@ -142,7 +142,7 @@ impl From<Vec<Field>> for Response {
|
||||
if has_newtype_body {
|
||||
panic!("ruma_api! responses cannot have both normal body fields and a newtype body field");
|
||||
} else {
|
||||
return ResponseField::Body(field);
|
||||
ResponseField::Body(field)
|
||||
}
|
||||
}
|
||||
ResponseFieldKind::Header => ResponseField::Header(field, header.expect("missing header name")),
|
||||
@ -164,7 +164,7 @@ impl ToTokens for Response {
|
||||
pub struct Response
|
||||
};
|
||||
|
||||
let response_struct_body = if self.fields.len() == 0 {
|
||||
let response_struct_body = if self.fields.is_empty() {
|
||||
quote!(;)
|
||||
} else {
|
||||
let fields = self.fields.iter().fold(TokenStream::new(), |mut fields_tokens, response_field| {
|
||||
|
@ -4,7 +4,6 @@
|
||||
//! See the documentation for the `ruma_api!` macro for usage details.
|
||||
|
||||
#![deny(missing_debug_implementations)]
|
||||
#![feature(proc_macro)]
|
||||
#![recursion_limit="256"]
|
||||
|
||||
extern crate proc_macro;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![feature(proc_macro, try_from)]
|
||||
#![feature(try_from)]
|
||||
|
||||
extern crate futures;
|
||||
extern crate http;
|
||||
|
Loading…
x
Reference in New Issue
Block a user