Fix rustc 1.37 build

This commit is contained in:
Graham Esau 2021-03-27 10:34:39 +00:00
parent 29dc025629
commit dada8582ee

View file

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