Clippy fixes

This commit is contained in:
Graham Esau 2021-03-27 00:45:06 +00:00
parent 61d64df57d
commit 29dc025629
7 changed files with 69 additions and 63 deletions

View file

@ -143,7 +143,7 @@ fn add_trait_bounds(generics: &mut syn::Generics) {
}
}
fn compile_error<'a>(errors: Vec<syn::Error>) -> TokenStream {
fn compile_error(errors: Vec<syn::Error>) -> TokenStream {
let compile_errors = errors.iter().map(syn::Error::to_compile_error);
quote! {
#(#compile_errors)*

View file

@ -35,8 +35,8 @@ impl ToTokens for SchemaMetadata<'_> {
impl<'a> SchemaMetadata<'a> {
pub fn from_attrs(attrs: &'a Attrs) -> Self {
SchemaMetadata {
title: attrs.title.as_ref().and_then(none_if_empty),
description: attrs.description.as_ref().and_then(none_if_empty),
title: attrs.title.as_deref().and_then(none_if_empty),
description: attrs.description.as_deref().and_then(none_if_empty),
deprecated: attrs.deprecated,
examples: &attrs.examples,
read_only: false,
@ -106,7 +106,7 @@ impl<'a> SchemaMetadata<'a> {
}
}
fn none_if_empty(s: &String) -> Option<&str> {
fn none_if_empty(s: &str) -> Option<&str> {
if s.is_empty() {
None
} else {