Fix rustc 1.37 build
This commit is contained in:
parent
29dc025629
commit
dada8582ee
1 changed files with 4 additions and 3 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue