Fix rustc 1.32 build

This commit is contained in:
Graham Esau 2020-05-17 11:27:11 +01:00
parent 1b42dc7e3e
commit 75419fa3d5

View file

@ -33,8 +33,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,
..Default::default() ..Default::default()
} }
@ -90,7 +90,7 @@ impl<'a> SchemaMetadata<'a> {
} }
} }
fn none_if_empty<'a>(s: &'a str) -> Option<&'a str> { fn none_if_empty<'a>(s: &'a String) -> Option<&'a str> {
if s.is_empty() { if s.is_empty() {
None None
} else { } else {